## 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/ # 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.21 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 \ pkg-config \ 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"]