[Docker] Add Dockerfile

This commit is contained in:
Killian Kemps
2020-04-28 17:12:51 +02:00
parent 9e0ec5ff0f
commit e86bd1562d
3 changed files with 106 additions and 0 deletions

35
docker/Dockerfile Normal file
View File

@@ -0,0 +1,35 @@
FROM python:3.7-slim-buster
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
make \
&& apt-get clean
COPY Makefile /opt/snikket-web-portal/Makefile
COPY requirements.txt /opt/snikket-web-portal/requirements.txt
COPY build-requirements.txt /opt/snikket-web-portal/build-requirements.txt
COPY snikket_web/ /opt/snikket-web-portal/snikket_web
COPY babel.cfg /opt/snikket-web-portal/babel.cfg
COPY web_config.production.py /opt/snikket-web-portal/.local/web_config.py
WORKDIR /opt/snikket-web-portal
RUN pip install -r requirements.txt \
&& pip install -r build-requirements.txt
RUN make
ENV SNIKKET_WEB_CONFIG "/opt/snikket-web-portal/.local/web_config.py"
RUN pip install hypercorn
ADD docker/entrypoint.sh /bin/entrypoint.sh
ENTRYPOINT ["/bin/sh", "/bin/entrypoint.sh"]

17
docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
if [ -z "$SNIKKET_DOMAIN" ]; then
echo "Please provide SNIKKET_DOMAIN";
exit 1;
fi
if [ -z "$PROSODY_ENDPOINT" ]; then
echo "Please provide PROSODY_ENDPOINT";
exit 1;
fi
if [ -z "$SECRET_KEY" ]; then
echo "Please provide SECRET_KEY";
fi
exec hypercorn -b "0.0.0.0:8000" snikket_web:app