forked from mozilla-releng/balrog
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
53 lines (45 loc) · 2.23 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
FROM python:3.7-slim-stretch
MAINTAINER [email protected]
# Some versions of the python:3.7 Docker image remove libpcre3, which uwsgi needs for routing support to be enabled.
# Node and npm are to build the frontend. nodejs-legacy is needed by this version of npm. These will get removed after building.
# default-libmysqlclient-dev is required to use SQLAlchemy with MySQL, which we do in production.
# xz-utils is needed to compress production database dumps
RUN apt-get -q update \
&& apt-get -q --yes install libpcre3 libpcre3-dev default-libmysqlclient-dev mysql-client xz-utils \
&& apt-get clean
WORKDIR /app
# install the requirements into the container first
# these rarely change and is more cache friendly
# ... really speeds up building new containers
COPY requirements.txt /app/
RUN apt-get install -q --yes gcc && \
pip install -r requirements.txt && \
apt-get -q --yes remove gcc && \
apt-get -q --yes autoremove && \
apt-get clean && \
rm -rf /root/.cache
# Copying Balrog to /app instead of installing it means that production can run
# it, and we can bind mount to override it for local development.
COPY auslib/ /app/auslib/
COPY ui/ /app/ui/
COPY uwsgi/ /app/uwsgi/
COPY scripts/manage-db.py scripts/run-batch-deletes.sh scripts/run.sh scripts/reset-stage-db.sh scripts/get-prod-db-dump.py scripts/releases-history-to-gcs.py /app/scripts/
COPY version.json /app/
WORKDIR /app
RUN cd ui && \
echo "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list && \
apt-get -q update && \
apt-get -q --yes install -t stretch-backports git nodejs npm && \
npm install && \
npm run build && \
rm /etc/apt/sources.list.d/stretch-backports.list && \
apt-get -q --yes remove nodejs npm && \
apt-get -q --yes autoremove && \
apt-get clean && \
rm -rf /root/.npm /tmp/phantomjs && \
find . -maxdepth 1 -not -name dist -exec rm -rf {} \;
# Using /bin/bash as the entrypoint works around some volume mount issues on Windows
# where volume-mounted files do not have execute bits set.
# https://github.com/docker/compose/issues/2301#issuecomment-154450785 has additional background.
ENTRYPOINT ["/bin/bash", "/app/scripts/run.sh"]
CMD ["public"]