Commit 50587721 authored by Alexander Lercher's avatar Alexander Lercher

secured homepage with ssl

parent 3051a5d2
......@@ -17,4 +17,8 @@ COPY main.py /app/
COPY templates/ /app/templates/
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
CMD ["python", "./main.py"]
# docker build -t alexx882/hello-articonf .
# docker run --name articonf-home -p 80:5000 -v /srv/articonf:/srv/articonf -d alexx882/hello-articonf
# docker run --name articonf-home-ssl -p 443:5000 -v /srv/articonf:/srv/articonf -d alexx882/hello-articonf
\ No newline at end of file
import os
from flask import Flask, render_template
app = Flask(__name__)
......@@ -6,4 +7,11 @@ app = Flask(__name__)
def hello_world():
return render_template('index.html')
app.run(host='0.0.0.0', port=5000, debug=True)
\ No newline at end of file
# SSL configuration
try:
certificate_path = os.environ['ARTICONF_CERTIFICATE_PATH']
except KeyError:
certificate_path = '/srv/articonf/'
context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files
app.run(host='0.0.0.0', port=5000, debug=False, ssl_context=context)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment