Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (42 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (42 loc) · 1.54 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
45
46
47
48
49
50
51
52
# Based on python image which itself is based on debian image
# https://hub.docker.com/_/python
# https://hub.docker.com/_/debian
FROM python:3.14-slim
# Maintainer information
LABEL maintainer="Dribdat Contributors <dribdat@datalets.ch>"
# Environment
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Copy pip requirements
COPY pyproject.toml .
# Install compiler (used by some pip packages)
RUN : \
&& apt-get update \
&& apt-get install gcc g++ make libev-dev libuv1-dev libc-ares-dev -y \
&& apt-get clean
# Install requirements
RUN : \
&& python -m pip install --upgrade pip setuptools \
&& EMBED=0 pip install gevent poetry \
&& python -m poetry install \
&& apt-get purge --auto-remove -y
# Copy app files (please see dockerignore)
COPY . /app
# Run commands
RUN set -x \
&& mkdir /docker-entrypoint.d \
&& mv /app/image/docker-entrypoint.d/* /docker-entrypoint.d/ \
&& mv /app/image/docker-entrypoint.sh /docker-entrypoint.sh \
&& chmod +x /docker-entrypoint.sh \
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
&& adduser --uid 5678 --disabled-password --gecos "" appuser \
&& chown -R appuser /app \
&& chown -R appuser /docker-entrypoint.d \
&& chown appuser /docker-entrypoint.sh
WORKDIR /app
USER appuser
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 5000
CMD ["gunicorn","--config=gunicorn.conf.py","patched:init_app()"]