/
Dockerfile
35 lines (28 loc) · 896 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM alpine:3.18
# Use alpine linux as base image
ARG DOCKER_TAG
RUN apk update --no-cache \
&& apk upgrade --no-cache \
&& apk --no-cache add \
python3 \
py3-pip \
&& adduser --disabled-password web \
&& mkdir -p /home/web/log/ \
&& chown -R web.web /home/web/
USER web
WORKDIR /home/web
COPY --chown=web:web test_server /home/web/test_server
COPY --chown=web:web requirements.txt run_gunicorn.sh wsgi.py /home/web/
ENV PATH=$PATH:/home/web/.local/bin \
VERSION=$DOCKER_TAG \
PORT=8080 \
ERRLOG="-" \
ACCESSLOG="-" \
LOGFORMAT="%(h)s %(l)s %(t)s %({Server-IP}o)s %(l)s %(r)s %(s)s %(b)s %(a)s" \
LOGLVL=INFO \
SECRET_KEY=DockerFileSecret
# Install application
RUN pip install --user -r requirements.txt
EXPOSE 8080
CMD sh run_gunicorn.sh
HEALTHCHECK --interval=15s --timeout=5s --retries=5 CMD wget --spider http://localhost:8080/health || exit 1