forked from mozilla/treeherder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.58 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (39 loc) · 1.58 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
## Frontend stage
FROM node:20.6.1 AS frontend
WORKDIR /app
COPY ui/ /app/ui/
COPY package.json babel.config.json webpack.config.js yarn.lock /app/
# ensure we have python-venv available for glean
RUN apt-get update && apt-get install python3-venv -y
RUN npm install -g --force yarn@1.22.19
RUN yarn install
RUN yarn build
## Backend stage
FROM python:3.9.18-slim-bullseye
# libmysqlclient-dev is required for the mysqlclient Python package.
RUN apt-get update && apt-get install -y --no-install-recommends \
default-libmysqlclient-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements/ /app/requirements/
RUN apt-get update && apt-get install -q --yes gcc && \
pip install --no-deps -r requirements/common.txt && \
apt-get -q --yes remove gcc && \
apt-get -q --yes autoremove && \
apt-get clean && \
rm -rf /root/.cache
COPY bin/ /app/bin/
COPY docker/entrypoint_prod.sh /app/docker/entrypoint_prod.sh
COPY treeherder/ /app/treeherder/
COPY schemas/ /app/schemas/
COPY manage.py newrelic.ini version.json /app/
COPY --from=frontend /app/.build/ /app/.build/
RUN python manage.py collectstatic --noinput
# Generate gzipped versions of files that would benefit from compression, that
# WhiteNoise can then serve in preference to the originals. This is required
# since WhiteNoise's Django storage backend only gzips assets handled by
# collectstatic, and so does not affect files in the `.build/` directory
# since they are instead generated by webpack.
RUN python -m whitenoise.compress .build
ENTRYPOINT ["/bin/bash", "/app/docker/entrypoint_prod.sh"]
CMD ["web"]