fixed some bugs and updated docker stuff

This commit is contained in:
msinkec 2021-02-20 20:07:21 +01:00
parent 36dbe487ed
commit c1d6cbbb70
3 changed files with 22 additions and 10 deletions

View File

@ -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"]

18
app.py
View File

@ -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:

View File

@ -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: