Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Dockerfile.cabotage
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Adapted from https://github.com/buildbot/buildbot/raw/refs/heads/master/Dockerfile.master

# Build the environment in an intermediate image, then copy it over to final.

ARG DEBIAN_VERSION="trixie"

FROM --platform=${BUILDPLATFORM} docker.io/library/debian:${DEBIAN_VERSION} AS buildbot-build

RUN \
apt-get update && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends --no-install-suggests -q \
ca-certificates \
curl \
make \
git \
build-essential \
python3-dev \
virtualenv \
libpq-dev \
&& \
rm -rf /var/lib/apt/lists/*

# Copy requirements separately to avoid unnecessary rebuilds.
COPY requirements*.txt /srv/buildbot/

RUN virtualenv --python=python3 /srv/buildbot/venv && \
/srv/buildbot/venv/bin/pip3 install -r /srv/buildbot/requirements-*.txt

COPY . /srv/buildbot

# Copy docker-specific config into place
COPY docker/buildbot.tac /srv/buildbot/master/buildbot.tac
COPY docker/start_buildbot.sh /srv/buildbot/start_buildbot.sh


#==============================================================================
# Build the final image here. Use build artifacts from the buildbot-build
# container.

FROM docker.io/library/debian:${DEBIAN_VERSION}-slim AS buildbot-master

RUN \
apt-get update && \
apt-get -y upgrade && \
apt-get -y install -q \
curl \
dumb-init \
git \
libpq5 \
libcairo2 \
openssh-client \
python3 \
tar \
tzdata \
&& \
rm -rf /var/lib/apt/lists

COPY --from=buildbot-build /srv/buildbot /srv/buildbot

WORKDIR /srv/buildbot
CMD ["dumb-init", "/srv/buildbot/start_buildbot.sh"]
27 changes: 27 additions & 0 deletions docker/buildbot.tac
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import sys

from twisted.application import service
from twisted.logger import ILogObserver
from twisted.logger import textFileLogObserver
from twisted.logger import LogLevelFilterPredicate
from twisted.logger import FilteringLogObserver

from buildbot.master import BuildMaster

basedir = os.environ.get("BUILDBOT_BASEDIR",
os.path.abspath(os.path.dirname(__file__)))
configfile = 'master.cfg'

# note: this line is matched against to check that this is a buildmaster
# directory; do not edit it.
application = service.Application('buildmaster')
application.setComponent(
ILogObserver,
FilteringLogObserver(
textFileLogObserver(sys.stdout), predicates=[LogLevelFilterPredicate()]
),
)

m = BuildMaster(basedir, configfile, umask=None)
m.setServiceParent(application)
21 changes: 21 additions & 0 deletions docker/start_buildbot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Adapted from https://github.com/buildbot/buildbot/raw/refs/heads/master/master/docker/start_buildbot.sh

# startup script for purely stateless master

export PATH="/srv/buildbot/venv/bin:$PATH"

B=/srv/buildbot/master

# Fixed buildbot master not start error in docker
rm -f "$B/twistd.pid"
# wait for db to start by trying to upgrade the master
until buildbot upgrade-master "$B"
do
echo "Can't upgrade master yet. Waiting for database ready?"
sleep 1
done

# we use exec so that twistd use the pid 1 of the container, and so that signals are properly forwarded
exec twistd -ny "$B/buildbot.tac"
Loading