-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
99 lines (67 loc) · 2.76 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
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
FROM ubuntu:24.04 AS build
RUN apt-get update
RUN apt-get install -y git python3-virtualenv python3-pip python3-setuptools pkg-config default-libmysqlclient-dev
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
WORKDIR /app
COPY requirements.txt .
COPY requirements-deploy.txt .
RUN python3 -m virtualenv /venv
RUN python -m pip install --no-cache-dir -r requirements.txt -r requirements-deploy.txt
######################################################################
FROM ubuntu:24.04 AS platform_resource
RUN apt-get update
RUN apt-get install -y --no-install-recommends python3-mysqldb npm
RUN npm install yuglify -g
RUN apt-get clean
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
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 update
RUN apt-get install -y --no-install-recommends apache2 libapache2-mod-wsgi-py3 python3-mysqldb libjpeg-dev ca-certificates
RUN apt-get clean
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
ENV APACHE_RUN_USER=ubuntu
WORKDIR /app
COPY container/apache2.conf /etc/apache2
COPY container/apache-000-default.conf /etc/apache2/sites-enabled/000-default.conf
COPY container/apache-ports.conf /etc/apache2/ports.conf
COPY container/apache-mod-servername.conf /etc/apache2/mods-enabled/servername.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
EXPOSE 8000
CMD ["apache2ctl", "-D", "FOREGROUND"]
######################################################################
FROM ubuntu:24.04 AS platform_worker
RUN apt-get update
RUN apt-get install -y --no-install-recommends supervisor python3-mysqldb libjpeg-dev ca-certificates
RUN apt-get clean
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/venv/bin:$PATH"
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.disabled
COPY container/docker-worker-entrypoint.sh /docker-entrypoint.sh
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
ENTRYPOINT ["/docker-entrypoint.sh"]