Skip to content

Commit 24df470

Browse files
committed
docker: Switch to Debian and build all master packages
Previously we were installing buildbot-www from whatever is available on Pypi. This leads to wrong versions being taken for docker containers built from tags. E.g. if 2.10.5 is built, one expects buildbot-www to correspond to 2.10.5 code, not what's latest on Pypi. Fortunately we can just reuse the existing release build code to build www packages for the container and solve the problem this way. Current Dockerfile uses Alpine, which is great for reducing the container footprint, but for master this is less important because by design there will be few instances running. Additionally, most of the users of Buildbot (myself included) are much more likely to have more experience with Debian. Given that I need to make significant changes to the Dockerfile anyway, I'm switching it to Debian.
1 parent fa7811d commit 24df470

7 files changed

Lines changed: 127 additions & 100 deletions

File tree

.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**/*.pyc
2+
**/dist
3+
**/*.egg-info
4+
**/build
5+
**/node_modules
6+
7+
# Note: not ignoring .git so that build scripts can figure out which version of Buildbot we're
8+
# building.
9+
10+
.dockerignore
11+
.venv*
12+
Dockerfile.master
13+
master/_build
14+
master/docs/manual/mydashboard.html
15+
master/docs/manual/mydashboard.py
16+
_trial_temp

Dockerfile.master

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# buildbot/buildbot-master
2+
3+
# please follow docker best practices
4+
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
5+
6+
# Use a multi-stage build:
7+
# https://docs.docker.com/develop/develop-images/multistage-build/
8+
9+
# Provides a base Debian (10) image with latest buildbot mater installed
10+
# the master image is not optimized for size, but rather uses Debian for wider package availability
11+
12+
# Provide an intermediate Docker image named "buildbot-build".
13+
# This intermediate image builds binary wheels
14+
# which get installed in the final image.
15+
# This allows us to avoid installing build tools like gcc in the final image.
16+
17+
FROM debian:10 AS buildbot-build
18+
MAINTAINER Buildbot maintainers
19+
20+
# Last build date - this can be updated whenever there are security updates so
21+
# that everything is rebuilt
22+
ENV security_updates_as_of 2021-04-28
23+
24+
RUN \
25+
apt-get update && \
26+
apt-get -y upgrade && \
27+
apt-get -y install -q \
28+
curl \
29+
git \
30+
libcairo-gobject2 \
31+
libcairo2-dev \
32+
libgirepository1.0-dev \
33+
libglib2.0-dev \
34+
libffi-dev \
35+
libpq-dev \
36+
libssl-dev \
37+
pkg-config \
38+
python3 \
39+
python3-dev \
40+
python3-pip \
41+
yarnpkg \
42+
tar \
43+
tzdata \
44+
virtualenv \
45+
&& \
46+
rm -rf /var/lib/apt/lists/*
47+
48+
COPY . /usr/src/buildbot
49+
50+
RUN cd /usr/src/buildbot && make tarballs
51+
RUN virtualenv --python=python3 /buildbot_venv && \
52+
/buildbot_venv/bin/pip3 install -r /usr/src/buildbot/requirements-master-docker-extras.txt && \
53+
env CRYPTOGRAPHY_DONT_BUILD_RUST=1 /buildbot_venv/bin/pip3 install /usr/src/buildbot/dist/*.whl
54+
55+
RUN mkdir -p /wheels && \
56+
/buildbot_venv/bin/pip3 list --format freeze | grep -v '^buildbot' | grep -v '^pkg-resources' > /wheels/wheels.txt && \
57+
cd /wheels && \
58+
/buildbot_venv/bin/pip3 wheel -r wheels.txt && \
59+
rm /wheels/wheels.txt && \
60+
cp /usr/src/buildbot/dist/*.whl /wheels
61+
62+
#==============================================================================================
63+
# Build the final image here. Use build artifacts from the buildbot-build
64+
# container.
65+
66+
# Note that the UI and worker packages are the latest version published on pypi
67+
# This is to avoid pulling node inside this container
68+
69+
FROM debian:10-slim
70+
MAINTAINER Buildbot maintainers
71+
72+
# Last build date - this can be updated whenever there are security updates so
73+
# that everything is rebuilt
74+
ENV security_updates_as_of 2021-04-28
75+
76+
COPY . /usr/src/buildbot
77+
78+
RUN \
79+
apt-get update && \
80+
apt-get -y upgrade && \
81+
apt-get -y install -q \
82+
curl \
83+
dumb-init \
84+
git \
85+
libpq5 \
86+
libcairo2 \
87+
openssh-client \
88+
python3 \
89+
python3-pip \
90+
tar \
91+
tzdata \
92+
virtualenv \
93+
&& \
94+
rm -rf /var/lib/apt/lists
95+
96+
# Build wheels in other container using the Dockerfile.build
97+
# and copy them into this container.
98+
# We do this to avoid having to pull gcc for building native extensions.
99+
COPY --from=buildbot-build /wheels /wheels
100+
101+
# install pip dependencies
102+
RUN pip3 install --upgrade pip setuptools && \
103+
cd /wheels && pip3 install $(ls -1 | grep -v 'buildbot-worker') && \
104+
rm -r /root/.cache /wheels
105+
106+
WORKDIR /buildbot
107+
CMD ["dumb-init", "/usr/src/buildbot/docker/start_buildbot.sh"]

master/.dockerignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

master/Dockerfile

Lines changed: 0 additions & 94 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The docker container for the master has been switched to Debian.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The docker container for the master now fully builds the www packages.
2+
Previously they were downloaded from pypi which resulted in downloading whatever version was newest at the time (:issue:`4998`).
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
requests==2.25.1
22
psycopg2==2.8.6
33
txrequests==0.9.6
4+
pycairo==1.20.0

0 commit comments

Comments
 (0)