From 7502ba09b725482ef04ad90fc95c951f9946407e Mon Sep 17 00:00:00 2001 From: Parodper Date: Sun, 31 Dec 2023 18:21:32 +0100 Subject: [PATCH] Creado Dockerfile --- Dockerfile | 9 +++++++++ README.md | 4 ++-- docker-compose.yml | 12 ++++++++++++ serve.py | 3 ++- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..40a412e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.11-alpine + +WORKDIR / +#RUN git clone https://git.disroot.org/parodper/comparar_guias_docentes.git +COPY . /comparar_guias_docentes + +WORKDIR /comparar_guias_docentes +RUN pip install html2text bs4 requests +RUN chmod 0500 serve.py main.py diff --git a/README.md b/README.md index 1abf177..78d93e1 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ Programa para comparar guĂ­as docentes de distintos anos Dependencias: -* html2text (2020.1.16) +* html2text (probado con 2020.1.16) * bs4 (probado con 4.12.2/bs4==0.0.1) -* requests (2.31.0) +* requests (probado con 2.31.0) ## Uso diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6d8e107 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' +services: + comparar_guias_docentes: + build: + context: . + dockerfile: Dockerfile + volumes: + - ./cache:/comparar_guias_docentes/cache + - ./out:/comparar_guias_docentes/out + command: ./serve.py 0.0.0.0 80 + ports: + - 8080:80 diff --git a/serve.py b/serve.py index e677cce..2561b78 100644 --- a/serve.py +++ b/serve.py @@ -55,8 +55,9 @@ class ServidorIPv6(HTTPServer): if __name__ == '__main__': try: ops = (sys.argv[1], int(sys.argv[2])) + logging.info(f'Executando servidor en {ops[0]}:{ops[1]}') httpd = HTTPServer(ops, ServidorHTTP) \ - if type(ipaddress.ip_address(sys.argv[1])) != ipaddress.IPv6Address \ + if type(ipaddress.ip_address(ops[0])) != ipaddress.IPv6Address \ else ServidorIPv6(ops, ServidorHTTP) httpd.serve_forever() except IndexError: