-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (27 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
44 lines (27 loc) · 1.03 KB
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
36
37
38
39
40
41
42
43
44
FROM python:3.10.7-alpine3.16
RUN apk add bash curl gcc libc-dev libffi-dev
RUN apk add sqlite
RUN pip3 install greenlet==1.1.2 gunicorn==20.1.0 gevent==21.12.0
# Create a group and user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /license-manager
COPY requirements.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt
COPY ./src /license-manager/src
COPY .env /license-manager/src
RUN mkdir -p /license-manager/src/database
VOLUME /license-manager/src/database
ARG DEFAULT_WORKERS=2
ARG DEFAULT_THREADS=4
ARG DEFAULT_PORT=8000
ENV WORKERS=${DEFAULT_WORKERS}
ENV THREADS=${DEFAULT_THREADS}
ENV PORT=${DEFAULT_PORT}
EXPOSE ${PORT}
RUN set FLASK_RUN_PORT=${PORT}
RUN set FLASK_ENV=production
HEALTHCHECK --interval=15m --timeout=5s \
CMD curl --fail http://localhost:${PORT} || exit 1
# Tell docker that all future commands should run as the appuser user
USER appuser
CMD ["bash", "-c", "gunicorn -w ${WORKERS} --threads ${THREADS} -b :${PORT} -k gevent --preload 'src:create_app()'"]