diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..1a6a0cd --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +NETWORK_EMAIL_EXTRACTOR=network-email-extractor + +APP_NAME=email-extractor +APP_IMAGE=python +APP_IMAGE_LOCAL=localhost +APP_VERSION=3.7.4-buster diff --git a/.gitignore b/.gitignore index 582d452..2127570 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Emails.db .google-cookie /venv +*env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d375bde --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +ARG IMAGE + +ARG VERSION + +FROM $IMAGE:$VERSION + +# IMPORTANT: remeber to declare ARG values AFTER FROM sentence.... + +MAINTAINER info@kedu.coop + +ADD requirements.txt . + +ADD EmailExtractor.py . + +RUN pip install -r requirements.txt diff --git a/README.md b/README.md index 2bb59ec..1672cec 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,44 @@ pip install -r requirements.txt [Extraer correos de paginas web con Python](http://www.pythondiario.com/2018/04/extraer-correos-electronicos-de-paginas.html) + +## Docker + +Docker and docker-compose are required. + +In order to use docker follow below instructions: + +### Installation + +1. Get an .env file + +``` +cp .env.example .env +``` + +2. Start docker container + +``` +docker-compose up -d --build +``` + +### Usage + +To execute the script and get the options menu: + +``` +docker exec -ti email-extractor python EmailExtractor.py +``` + +To get the sqlite db with al e-mails: + +``` +docker cp email-extractor:Emails.db . +``` + +To get the file saved, for instance, as "out": + +``` +ocker cp email-extractor:out.txt . +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..7ec56c1 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,20 @@ +version: '3.7' + +services: + + email-extractor: + container_name: ${APP_NAME} + image: ${APP_IMAGE_LOCAL}/${APP_NAME}:${APP_VERSION} + networks: + - ${NETWORK_EMAIL_EXTRACTOR} + build: + context: . + args: + - IMAGE=${APP_IMAGE} + - VERSION=${APP_VERSION} + stdin_open: true + tty: true + +networks: + network-email-extractor: + name: ${NETWORK_EMAIL_EXTRACTOR}