This repository has been archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
57 lines (37 loc) · 1.6 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
ARG INSTALL_PYTHON_VERSION=${INSTALL_PYTHON_VERSION:-3.8}
FROM python:${INSTALL_PYTHON_VERSION}-slim-buster AS base
LABEL maintainer="Leon Morten Richter <[email protected]>"
# Install minimal dependencies which are not included in the python image
RUN apt-get update
RUN apt-get install -y \
curl \
gcc \
make
WORKDIR /app
# copy everything except files listed in the .dockerignore
COPY . .
# add a new user for running the app and transfer ownership of the application
RUN useradd -m pricy
RUN chown -R pricy:pricy /app
USER pricy
# add /home/pricy/.local/bin' to PATH
ENV PATH="/home/pricy/.local/bin:${PATH}"
# install deps which are the same for all apps
RUN pip install --user -r ./misc/requirements/requirements_base.txt
# ================================= DEVELOPMENT ================================
FROM base AS development
RUN pip install --user -r ./misc/requirements/requirements_dev.txt
EXPOSE 5000
CMD [ "python", "manage.py", "run", "-h", "0.0.0.0" ]
# ================================= TEST ================================
FROM base AS test
RUN pip install --user -r ./misc/requirements/requirements_dev.txt
CMD [ "make", "test" ]
# ================================= PRODUCTION =================================
FROM base AS production
RUN pip install --user -r ./misc/requirements/requirements_prod.txt
COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY misc/supervisord_programs /etc/supervisor/conf.d
EXPOSE 5000
ENTRYPOINT ["/bin/bash", "misc/supervisord_entrypoint.sh"]
CMD ["-c", "/etc/supervisor/supervisord.conf"]