treeherder/docker/Dockerfile

46 строки
1.3 KiB
Docker

## Frontend stage
FROM node:21.1.0 AS frontend
WORKDIR /app
COPY ui/ /app/ui/
COPY package.json babel.config.json webpack.config.js yarn.lock /app/
RUN npm install -g --force yarn@1.22.22
RUN yarn install
RUN yarn build
## Backend stage
FROM python:3.10.15-slim-bullseye
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"]