-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
110 lines (77 loc) · 3.36 KB
/
Dockerfile
File metadata and controls
110 lines (77 loc) · 3.36 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
FROM ubuntu:24.04 AS build
ARG ENVIRONMENT=prod
RUN apt-get --fix-missing update
RUN apt-get install -y git python3-virtualenv python3-pip python3-setuptools pkg-config default-libmysqlclient-dev
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
WORKDIR /app
COPY requirements.txt .
COPY requirements-deploy.txt .
# Since /venv/bin is the first thing on the PATH, once we've installed in to /venv, all subsequent
# usage of python will use the one installed in /venv
RUN python3 -m virtualenv /venv
RUN python -m pip install --no-cache-dir -r requirements.txt -r requirements-deploy.txt
RUN if [[ "$ENVIRONMENT" == "*local*" ]] ; then RUN python -m pip install --no-cache-dir -r requirements-dev.txt; fi
######################################################################
FROM ubuntu:24.04 AS platform_resource
RUN apt-get --fix-missing update && \
apt-get install -y --no-install-recommends python3-mysqldb npm && \
npm install yuglify -g && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
ENV TZ=UTC
WORKDIR /app
COPY container/docker-resource-entrypoint.sh /docker-entrypoint.sh
COPY --chown=ubuntu:ubuntu conf conf
COPY --chown=ubuntu:ubuntu helium helium
COPY --chown=ubuntu:ubuntu manage.py .
COPY --from=build --chown=ubuntu:ubuntu /venv /venv
ENTRYPOINT ["/docker-entrypoint.sh"]
######################################################################
FROM ubuntu:24.04 AS platform_api
RUN apt-get --fix-missing update && \
apt-get install -y --no-install-recommends python3-mysqldb libjpeg-dev ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
ENV TZ=UTC
ENV SSL_CERT_FILE=/venv/lib/python3.12/site-packages/certifi/cacert.pem
WORKDIR /app
RUN chown -R ubuntu:ubuntu .
COPY --chown=ubuntu:ubuntu conf conf
COPY --chown=ubuntu:ubuntu helium helium
COPY --chown=ubuntu:ubuntu manage.py .
COPY --from=build --chown=ubuntu:ubuntu /venv /venv
EXPOSE 8000
CMD ["gunicorn", "conf.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3", "--threads", "8", "--timeout", "60", "--keep-alive", "65", "--preload", "--access-logfile", "-", "--error-logfile", "-"]
######################################################################
FROM ubuntu:24.04 AS platform_worker
RUN apt-get --fix-missing update && \
apt-get install -y --no-install-recommends supervisor python3-mysqldb libjpeg-dev ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
ENV TZ=UTC
ENV SSL_CERT_FILE=/venv/lib/python3.12/site-packages/certifi/cacert.pem
WORKDIR /app
COPY container/supervisord.conf /etc/supervisor/
COPY container/supervisor-celeryworker.conf /etc/supervisor/conf.d/celeryworker.conf
COPY container/supervisor-celerybeat.conf /etc/supervisor/conf.d/celerybeat.conf
RUN chown -R ubuntu:ubuntu .
COPY --chown=ubuntu:ubuntu conf conf
COPY --chown=ubuntu:ubuntu helium helium
COPY --chown=ubuntu:ubuntu manage.py .
COPY --from=build --chown=ubuntu:ubuntu /venv /venv
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]