From c1d6cbbb70402dfac44206183517a4a4aa0be54d Mon Sep 17 00:00:00 2001 From: msinkec Date: Sat, 20 Feb 2021 20:07:21 +0100 Subject: [PATCH] fixed some bugs and updated docker stuff --- Dockerfile | 5 ++++- app.py | 18 +++++++++--------- docker-compose.yml | 9 +++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0509ad2..af80288 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,9 @@ COPY static /usr/src/portal-webapp/static COPY contract/ /usr/src/portal-webapp/contract WORKDIR /usr/src/portal-webapp -RUN pip install --no-cache-dir flask flask-dropzone gunicorn +RUN apt-get update && apt-get -y install wkhtmltopdf python3-pdfkit && \ + rm -rf /var/lib/apt/lists/* + +RUN pip3 install --no-cache-dir flask flask-dropzone gunicorn pdfkit CMD ["gunicorn", "--bind", "0.0.0.0:80", "-w", "1", "--access-logfile", "-", "app:app"] diff --git a/app.py b/app.py index da32e53..e60ff93 100644 --- a/app.py +++ b/app.py @@ -74,19 +74,19 @@ else: # Override configs with environment variables, if set if 'PORTALDS4DS1_MAIL_HOST' in os.environ: - MAIL_HOST = os.environ('PORTALDS4DS1_MAIL_HOST') + MAIL_HOST = os.environ['PORTALDS4DS1_MAIL_HOST'] if 'PORTALDS4DS1_MAIL_LOGIN' in os.environ: - MAIL_LOGIN = os.environ('PORTALDS4DS1_MAIL_LOGIN') + MAIL_LOGIN = os.environ['PORTALDS4DS1_MAIL_LOGIN'] if 'PORTALDS4DS1_MAIL_PASS' in os.environ: - MAIL_PASS = os.environ('PORTALDS4DS1_MAIL_PASS') + MAIL_PASS = os.environ['PORTALDS4DS1_MAIL_PASS'] if 'PORTALDS4DS1_SMTP_PORT' in os.environ: - SMTP_PORT = int(os.environ('PORTALDS4DS1_SMTP_PORT')) + SMTP_PORT = int(os.environ['PORTALDS4DS1_SMTP_PORT']) if 'PORTALDS4DS1_IMAP_PORT' in os.environ: - IMAP_PORT = int(os.environ('PORTALDS4DS1_IMAP_PORT')) -if 'MAX_UPLOAD_SIZE' in os.environ: - MAX_UPLOAD_SIZE = int(os.environ('PORTALDS4DS1_MAX_UPLOAD_SIZE')) -if 'CONTRACT_CLIENT_CONTACT' in os.environ: - CONTRACT_CLIENT_CONTACT = os.environ('PORTALDS4DS1_CONTRACT_CLIENT_CONTACT') + IMAP_PORT = int(os.environ['PORTALDS4DS1_IMAP_PORT']) +if 'PORTALDS4DS1_MAX_UPLOAD_SIZE' in os.environ: + MAX_UPLOAD_SIZE = int(os.environ['PORTALDS4DS1_MAX_UPLOAD_SIZE']) +if 'PORTALDS4DS1_CONTRACT_CLIENT_CONTACT' in os.environ: + CONTRACT_CLIENT_CONTACT = os.environ['PORTALDS4DS1_CONTRACT_CLIENT_CONTACT'] UPLOAD_DIR = BASE_DIR / 'uploads' if not UPLOAD_DIR.exists: diff --git a/docker-compose.yml b/docker-compose.yml index e208cc5..5a5f4bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,15 @@ services: webapp: build: . restart: always + environment: + - PORTALDS4DS1_MAIL_HOST=posta.cjvt.si + - PORTALDS4DS1_MAIL_LOGIN=oddaja-besedil@cjvt.si + - PORTALDS4DS1_MAIL_PASS=randompass123 + - PORTALDS4DS1_SMTP_PORT=465 + - PORTALDS4DS1_IMAP_PORT=993 + - PORTALDS4DS1_MAX_UPLOAD_SIZE=1000000000 + - PORTALDS4DS1_BASE_DIR=./ + - PORTALDS4DS1_CONTRACT_CLIENT_CONTACT=Testko Tester ports: - 127.0.0.1:5000:80 volumes: