docker: containerize master and slaves
authorJo-Philipp Wich <jo@mein.io>
Tue, 2 Jul 2019 05:19:05 +0000 (07:19 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 2 Jul 2019 20:25:04 +0000 (22:25 +0200)
Introduce docker builds for the buildmaster and slaves, and add
a docker-compose reference setup for quickly spinning up an
example build cluster.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
13 files changed:
.dockerignore [new file with mode: 0644]
.gitignore
docker/buildmaster/Dockerfile [new file with mode: 0644]
docker/buildmaster/files/entry.sh [new file with mode: 0644]
docker/buildmaster/files/start.sh [new file with mode: 0644]
docker/buildslave/Dockerfile [new file with mode: 0644]
docker/buildslave/files/entry.sh [new file with mode: 0644]
docker/buildslave/files/start.sh [new file with mode: 0644]
docker/config.phase1.ini [new file with mode: 0644]
docker/config.phase2.ini [new file with mode: 0644]
docker/docker-compose.yml [new file with mode: 0644]
docker/rsync/Dockerfile [new file with mode: 0644]
docker/rsync/files/entry.sh [new file with mode: 0644]

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..6e40471
--- /dev/null
@@ -0,0 +1,2 @@
+docker/build
+
index 6eb6b275e1aef1c0599685ba1e8e790456f053e9..dc6d78f12dacd440a98bcf8f5f1ede2ad3d2ef3e 100644 (file)
@@ -1,5 +1,11 @@
 *
 !.gitignore
+!.dockerignore
+!docker
+!docker/*
+!docker/*/*
+!docker/*/*/*
+docker/build
 !scripts
 !scripts/*
 !phase[12]
diff --git a/docker/buildmaster/Dockerfile b/docker/buildmaster/Dockerfile
new file mode 100644 (file)
index 0000000..0a2e8c5
--- /dev/null
@@ -0,0 +1,42 @@
+FROM        debian:9
+MAINTAINER  OpenWrt Maintainers
+
+ARG         DEBIAN_FRONTEND=noninteractive
+
+ENV         BUILDMASTER_CONFIG config.ini
+ENV         BUILDMASTER_PHASE  1
+
+USER root
+
+RUN apt-get update && \
+    apt-get install -y \
+       pwgen \
+       locales \
+       buildbot \
+       build-essential \
+       libncurses5-dev \
+       gawk \
+       git-core \
+       pv \
+       gosu \
+       signify-openbsd \
+       wget && \
+    apt-get clean && \
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+
+ENV LANG=en_US.utf8
+
+COPY docker/buildmaster/files/entry.sh /entry.sh
+COPY docker/buildmaster/files/start.sh /start.sh
+COPY phase1 /phase1
+COPY phase2 /phase2
+COPY scripts /scripts
+
+RUN mkdir /master && \
+    chown buildbot:buildbot /master && \
+    usermod --home /master buildbot && \
+    chmod 0755 /entry.sh /start.sh
+
+VOLUME [ "/master" ]
+ENTRYPOINT [ "/entry.sh" ]
+CMD [ "start" ]
diff --git a/docker/buildmaster/files/entry.sh b/docker/buildmaster/files/entry.sh
new file mode 100644 (file)
index 0000000..82d8b15
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+chown buildbot:buildbot /master
+
+/usr/sbin/gosu buildbot /start.sh "$@"
diff --git a/docker/buildmaster/files/start.sh b/docker/buildmaster/files/start.sh
new file mode 100644 (file)
index 0000000..7dc1192
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+case "${1:-start}" in
+       reconfig)
+               exec /usr/bin/buildbot reconfig /master
+       ;;
+       start)
+               case "${BUILDMASTER_PHASE:-1}" in
+                       1|2)
+                               cp /phase${BUILDMASTER_PHASE:-1}/config.ini.example /master/
+                       ;;
+                       *)
+                               echo "Invalid BUILDMASTER_PHASE given. Must be either '1' or '2'" >&2
+                               exit 1
+                       ;;
+               esac
+
+               /usr/bin/buildbot create-master --config=/phase${BUILDMASTER_PHASE:-1}/master.cfg /master
+
+               unset BUILDMASTER_PHASE
+
+               rm -f /master/twistd.pid
+               exec /usr/bin/buildbot start --nodaemon /master
+       ;;
+       /*)
+               exec "$@"
+       ;;
+       *)
+               echo "Unknown command given. Must be either 'start' or 'reconfig'" >&2
+               exit 1
+       ;;
+esac
diff --git a/docker/buildslave/Dockerfile b/docker/buildslave/Dockerfile
new file mode 100644 (file)
index 0000000..96919bd
--- /dev/null
@@ -0,0 +1,46 @@
+FROM        debian:9
+MAINTAINER  OpenWrt Maintainers
+
+ARG         DEBIAN_FRONTEND=noninteractive
+
+ENV         BUILDSLAVE_MASTER builds.openwrt.org:9990
+ENV         BUILDSLAVE_ADMIN contact@openwrt.org
+ENV         BUILDSLAVE_DESCRIPTION Buildslave Docker Instance
+
+USER root
+
+RUN apt-get update && \
+    apt-get install -y \
+       pwgen \
+       locales \
+       buildbot-slave \
+       build-essential \
+       git-core \
+       subversion \
+       libncurses5-dev \
+       gawk \
+       unzip \
+       pv \
+       gosu \
+       signify-openbsd \
+       python3 \
+       wget \
+       curl \
+       ccache \
+       rsync && \
+    apt-get clean && \
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+
+ENV LANG=en_US.utf8
+
+COPY docker/buildslave/files/entry.sh /entry.sh
+COPY docker/buildslave/files/start.sh /start.sh
+
+RUN mkdir /builder && \
+    chown buildbot:buildbot /builder && \
+    usermod --home /builder buildbot && \
+    chmod 0755 /entry.sh /start.sh
+
+VOLUME [ "/builder" ]
+ENTRYPOINT [ "/entry.sh" ]
+CMD [ "/start.sh" ]
diff --git a/docker/buildslave/files/entry.sh b/docker/buildslave/files/entry.sh
new file mode 100644 (file)
index 0000000..ad7e41c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+chown buildbot:buildbot /builder
+
+/usr/sbin/gosu buildbot "$@"
diff --git a/docker/buildslave/files/start.sh b/docker/buildslave/files/start.sh
new file mode 100644 (file)
index 0000000..e8fc8d7
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+[ -n "$BUILDSLAVE_NAME" ] || {
+       echo "Please supply a name via --env BUILDSLAVE_NAME=XXX" >&2
+       exit 1
+}
+
+[ -n "$BUILDSLAVE_PASSWORD" ] || {
+       echo "Please supply a password via --env BUILDSLAVE_PASSWORD=XXX" >&2
+       exit 2
+}
+
+/usr/bin/buildslave create-slave --umask=022 /builder \
+    "$BUILDSLAVE_MASTER" "$BUILDSLAVE_NAME" "$BUILDSLAVE_PASSWORD"
+
+echo "$BUILDSLAVE_ADMIN" > /builder/info/admin
+echo "$BUILDSLAVE_DESCRIPTION" > /builder/info/host
+
+unset BUILDSLAVE_ADMIN BUILDSLAVE_DESCRIPTION BUILDSLAVE_MASTER BUILDSLAVE_NAME BUILDSLAVE_PASSWORD
+
+rm -f /builder/twistd.pid
+exec /usr/bin/buildslave start --nodaemon /builder
diff --git a/docker/config.phase1.ini b/docker/config.phase1.ini
new file mode 100644 (file)
index 0000000..eeba06f
--- /dev/null
@@ -0,0 +1,127 @@
+[general]
+title = OpenWrt Project
+title_url = http://openwrt.org/
+buildbot_url = http://buildmaster-phase1:8010/
+workdir = /master
+expire = 1209600
+port = 9989
+config_seed = # Seed configuration
+       CONFIG_BUILDBOT=y
+       CONFIG_DEVEL=y
+       CONFIG_CCACHE=n
+       CONFIG_KERNEL_KALLSYMS=y
+       CONFIG_AUTOREMOVE=y
+
+[status]
+bind = tcp:8010:interface=0.0.0.0
+user = admin
+password = admin
+
+[repo]
+url = https://git.openwrt.org/openwrt/openwrt.git
+branch = master
+
+[rsync]
+binary_url = upload@rsync-server::data/bin
+binary_password = secret
+source_url = upload@rsync-server::data/src
+source_password = secret
+
+[gpg]
+key = -----BEGIN PGP PRIVATE KEY BLOCK-----
+       Comment: Example secret GPG key
+
+       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
+       3w==
+       =zJBW
+       -----END PGP PRIVATE KEY BLOCK-----
+passphrase = secret
+comment = Example GPG key
+
+[usign]
+key = RWRCSwAAAADUvtjCkFEF4bWWxpPBo9o8R5FK6Rz5aPUsaZONLu8kxIjud9Fd+Mgu7J2fFJDVyKFAXNH6pKS+AuBW3v+TQT5m1J0W/JYTjqzIrgAZhRtm5v3vSKRl3HUD2zEEbG5j3tg=
+comment = Example usign key
+
+[slave 1]
+name = buildslave-phase1
+password = secret
+builds = 1
+cleanup = 1
diff --git a/docker/config.phase2.ini b/docker/config.phase2.ini
new file mode 100644 (file)
index 0000000..67a97ca
--- /dev/null
@@ -0,0 +1,124 @@
+[general]
+title = OpenWrt Project
+title_url = http://openwrt.org/
+buildbot_url = http://buildmaster-phase2:8011/
+workdir = /master
+port = 9990
+persistent = false
+
+[status]
+bind = tcp:8011:interface=0.0.0.0
+user = admin
+password = admin
+
+[repo]
+url = https://git.openwrt.org/openwrt/openwrt.git
+branch = master
+
+[rsync]
+binary_url = upload@rsync-server::data/bin
+binary_password = secret
+source_url = upload@rsync-server::data/src
+source_password = secret
+sdk_url = upload@rsync-server::data/bin/targets
+sdk_password = secret
+sdk_pattern = openwrt-sdk-*.tar.xz
+
+[gpg]
+key = -----BEGIN PGP PRIVATE KEY BLOCK-----
+       Comment: Example secret GPG key
+
+       lQWGBF0ZCWsBDADXslVt7Rk/bPIduao3exEqGhzgR+Wv7i8H/gxZdxGbe+LpX04h
+       D60LOpCKf1T1MV0lPNk4FXhoj7I3qa1VQxDAg/6teBWIC4bKKj44pq09sljPVxRx
+       LJARWjBTM7GgGnu+8/UWTMDoDRLxSabDlFU3sWo4Xh6iCom8IjiZaOcmtDUlOjJs
+       0jwhelcmULPFBRVhIglNaHEaC06r/4jhpgzyEITQkQsh6QVYbMRtEi2bXoqfxu9f
+       /1CvYjO/4A6F9G3aG0ubu7SyggQ5lcObVr9poDPZ79x3e+1wGILUfUImE4MxVmN/
+       WNcPhJ13J6FvmLH2cj8oJhl4U5oWyxMRZg6CDpEO5UlP8wwB25DJ+5d/qsX3gEC5
+       chJQhwHgthHBGJMbbvCPXuSDW4s4TYbyVuG8IntLuzaowmjyiKH/BVUubFpMoM5p
+       69hwpjI30T3Dy5hhrgclIrbgeAInZ7y03VTjLbb9FuYSfGGi9FTcW+FJAdw3lWzC
+       vARoxtbiJ+J2QWkAEQEAAf4HAwKFxhkeBLI6K/CJR8c3UgEPSwvUq5B1KTtBUsBq
+       wODF1O/tZnZG0YREkqt2HTFU9nGYKyCHiKVqksBLDJx2aL++MwZIyelWTsa1juFV
+       1VFVp0ggHjHoVBGk37vpoHgqq6kATEKx92Hgd0AMsyvplQrxCtKu3NZu1V+O1wP4
+       1bgMqJy3uSVXzko6n+DixQOZCNf+6/3r+2pR3XK5aPc2hhMa+CYbNcqWfiVEnTIJ
+       tskohTsosnUUtPeq2B7c/dTdhGkhW1GiZLlAgOrpYqFqZgUUFwvnSeX3Gz73re6C
+       tfcWDVZau6dAm9j7z/fmXEmWwgmgPOWTxxbcSoKscFZL4e2rVxghtCsDTHH1PO5O
+       CJwPvpYty7CmkassnKzYFZ14krqAvCGE3xT6NzesdSyEcvu1RiZfO/7iWWHwNJbk
+       k0NEgxV+AB8zmg3hUd4D+XlMQLrkZKGGc22BOux3lS16oRvKoKtsjj0OrQ0j0bYY
+       2YS3Q0Bvbf9YH3h2HXfrjI3JE55MpC5s8bnXRl7ioH+qWh/E2KaZWQPmx566x+hf
+       hof89ODYc72LKuEOtzSbKGX7O1oivw0IPGm73yTHj6RYhJ16HmNvSmyMvuZCfwpo
+       cVM2muVnhJj4syrenvr5GeltYlLRrrxj0WWZnCqHo1MyFz7Ax9+knFqrTFiZ6wzU
+       vVI+/DWX/peMRlFtkxSP3KgFvx/TUu6j1rTsbuH+QauI4AX3RSEqpma2dP4yN3Tn
+       JDVanvpYqqJzHpmhIDDBDDRAEvLNf7bsWSctaOe4CLjGZC/4AHL2Z55QsZ627p0G
+       8TwV7lcsWU4q5zdZ8NDyfXuLTNv5A8/zrMy9NeqCitA7eOe+tBS/N7MBTRzZ7mKK
+       H4AXRpzrwBb0T6F6pjtrYp7cUTu6r1aBP2W61VzWWZChFM1AWfk3qgX4TvGikpe9
+       RfyUfPdALboZ4ZI2opoU9TQcjyhdLyfojMofoOdYZl68tImdd44+8sidj9ZW7JB3
+       +rrEBm4yWNOhTJnVnYaau+gY65WGYOb2rnSPlNa81aC2j141U2bxyigqTENH6W6N
+       xCAdIxWvXIYIRDSfrLFryGHdw/+O0SerK7NdCB3Yhb+YrzGMB1BOLFhbuXPnDMeB
+       JMN4WGCrxBl9a7Mtck/VSTXYPGqDA33AgOAgiJk/hVCc7Uq3TElro2FlvlOMUUzU
+       vAcM3ZMVDTa9FG9BGzpusf6P7JHfLJ/pIk6M0AfgWLnFSyR7OQZ26ImfWkOsRnqS
+       LzuQC4rpPQ8JViOwNdMsJ9Lh9ZIxSmeKdYAIdj0Rjv8xzE+QYVxVlCNzqA5XQSnW
+       ExyJIb5ZWWgfh7x60OF+7FcmXl7Z8zorxbQnRXhhbXBsZSBHUEcgS2V5IDxkZXZl
+       bG9wZXJAZXhhbXBsZS5vcmc+iQHUBBMBCAA+FiEE8tv6Y8FEu+A6mMiU4agkU1Bn
+       2NgFAl0ZCWsCGwMFCQPCZwAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ4agk
+       U1Bn2NirAwv/dNjiPyvLH57N9d0DTH+8G53JMaNNZiIeW4cbE1lTaVL1nL1cwEkp
+       enpCWg1S6OKxRQ+gDrPP94dwJFCdEgPdRV7+I4OU6fiPaHKAO7xZQM4MtlWpQnro
+       qXg7oC5LEj9gGNOE6mmtNEPd5xuIyfWXSbVd2222EbpdmSTrP5L52gehlG4o0GRc
+       GT3Y7o5LZ6VcJiZJWbjpzicLcJ7NJNIJ8ektYcSugKOEheXW1/ys0oEFlQ2SHuvZ
+       kjKbfYrCqj6pPd3oJIb4EDc5RK9ADGAsOKnHxcIMy/UyielushtG6E0x6OmONJTm
+       VNOz1i09nVaIHc4lM5Dq7ktrZQw//JcIJNH7OcnpcvFnnAsnE+UZEJNRIruPMJul
+       6FYrAGv+buuJ1BhcoCZeJ6ETzj0obrDtMhgpmbfM3HUhqUBJUZumx0zvMUEz+Mtx
+       +YiN6ECSFad0uLQPp4Qv+atBDvVIK8uSevJIZlxXgYSYpcPH2l4ZlANhF3Z/MWjc
+       0aK6p/W4Rha1nQWGBF0ZCWsBDAD8WYToIsYRAilX19cZ7V6RG0lGY6CpF8aOKRyY
+       LcH6T0lva0GrEXVwo2ms3bNSUnLzE8SKOPPam8FMT7xzEZ3caLnI6LB/n9DWPFI0
+       BVNOEBwFf7aadTBAZIRarO7fqIey/QnkBdw2UQYFTZBQMs7ov9LvZqmu0Ya0b/xs
+       NfhwWpb2QUGeeZThJlEWsatELphE81BdC4FvpPiAXN+JgL5prGQz2p87VDo6uu+9
+       W8Si81WQLvVXXEG0175UorQ6CwBiQVLjiaCGQ+Yn0ZkJVpwReKsSdwP7LBsVGuA+
+       YNoJW0+2oX+suFHrSbGdUGaSKEiR4AnHoSuFu4eK8FZNXyg9zoBv6M5QKU2lGFT6
+       V8TwbEIhLIIAwil+T+ZUu4tKbuDDFKh4CPalx5GehNN7ZRFOZgNz/rf7aOtA4s3P
+       kbB5fjR3+Z9ns70xej9z57kIIB1KgcX0Ov9kp5zNtZdpPRzRURPAEmhNveAHtEbR
+       aqBH64vxilDUXvcs1QlP4066TcsAEQEAAf4HAwJI+fXlrlUZcvBCEaouhaNghWDA
+       2dSvGyzrp32wmLXoRwC0wUiy4hUduxrEYECd1wjPM9t22j7++7SAfqdfto6RNXYT
+       AramO2Aj8ldqhJoCfkIh64pU0/hUmQnJ56KTdXLNuoDbF43usnDO0KvfSmvHMyBs
+       tADZ67fgit3043LZFEPbAov33b37qoLNvrqdQHes2olE32mpNOJoVyG3P5/3YixT
+       TalKWMhXiZ8xePzyrcw85hj/SBNIeVeJ4QRotlQJA7dvVxbEtATzN7wCv6B9BrE+
+       Lm3Es5zDrVX6n2zcnwRWh40lADZvEzKSXEI2priFEpdjU4HmMP9BZ2jnMMYB8wkP
+       IMSvlgWuXSt9t27lnpE1G/Wpk+Q02zTOTDsLRk9crUFTw3YoyPsp7QdQCtew0z3S
+       yIn/+Wer+p++d2/qgiZxlh15V8msj5qX6ALTZpZ0hg1+dpvvQMqTRJNiX81oenmF
+       FEWmDA6Q4cRjYhub2nDUdmxU5z3dlxr2F2Lrxuheg3zQyt6P0FD7yzL6aDsU7Eok
+       rvZrYcShWBPW7LigjHNKrdUoTLHAqj5asuPgqw+hQJ2x7e0VC3bAl/e8M1/vQ0Uw
+       UAD8q6wbE7+/C419K7JZchZeqfARl7qC29xsh22yLU33II5yzEwshaQCSF8RWBWi
+       D5Dvdkw9ZV94gz+8ZnAezFpkd1igA7Qcnfcsy/JwzsaOHkZN2nwfTeK2WW+NwMOu
+       PkJG8JuFpQ5QwcL5axion7QrvhrfdmV/o//IaAFyxnhOo3IddLNm8S+qpiU6HIj3
+       pyr6PJFlUq9gxpuCrRW+yXcvlqEdQygmDDr1UWlrblVoKgbIkZAJPvlCD29jhbaM
+       UryrhhOSURmf158FU5wA9DzlcsCwqdCPTnbeqfnxLRS/+hX3zB7T4ezIBya09o0s
+       iCEHP+8cOVsf2metZJ2ONrXnBp+LGoMqD8I4vGNIamvIZivPwq7LefUk1XhBd7Ed
+       aP50tYZuEQnoNpa4S6sR2qgxxCRLmqYRJvaabYdEUBdV8F/0K4XxJfMLPLZfhRO0
+       wdL1fRx2cxoeZH0BsEntQVHdhJJqRmPJNt8SyahwRrpoJ1Lb5iZm9yj0ZU4dP7h/
+       qbc66QCg/eqA+0r66xd6bzxORM/HjM0itNPkVp/4PdSKKQ0JnYRwtPNE3pBvuDCK
+       EZ5GPuCM0szInM11sLTf96HBL0G4VWspKqZIDS7ezZ7zj5TBooLTzglmy2rA0UAE
+       SrxvD0sI3ULEiNIEjogJJtj9MSATjPLXGzt+ekrlb+i6c1A2IrrPOUkEhAa6F4HL
+       0HcJn3/sWfOVH+mj5AinIsiosHvZiYOGoMBGHAmxUfi/74kBvAQYAQgAJhYhBPLb
+       +mPBRLvgOpjIlOGoJFNQZ9jYBQJdGQlrAhsMBQkDwmcAAAoJEOGoJFNQZ9jYMusL
+       +gLg/aXZj8w72Zdabvsuh+FsP1dRAvEpF+RFfmUTyCdxOA7xY9DScCaa5gBN35KI
+       EsKE3EQJr8W+iX0+jIrsyn00Tb4D0MA7oVHDYfDOlxXTk+NHs1GW6CN5aXSCkulT
+       7dP+09oqPXS4z/bcX2UTbhh01VgYAWrMOWj5ycza+OrF2+hK7U7sVQoTN7kMLvQs
+       C2CVJm4wppT6CYMhKOxVEkvL3fcK7ZYXRhBGij97vR7kCbXMoSDPKT7b0Ulm+pOj
+       k69gOBkKw95S2sGXifyp2t6tWrcfNf0K7cnp0yS0OYT64t670x9g/6qxduT4VueJ
+       gR8gW5jTxhyqiIKQ2t7rdlsOQHUAHDolwC/d+BoVC7kUj+450gzuIt9TF0yYRpiz
+       PPjCSsIQfwMGOGj8P5X06tjIAiJy79J1QoM6NaRaT3AX39edzUS5SsX2HaHPvk4D
+       UmP52XKFIRFi1EeDPLt1/JMzHc8+5fVxtXO+mFHKxD3Q3q9bAK7qcNsj0jtY7UzD
+       3w==
+       =zJBW
+       -----END PGP PRIVATE KEY BLOCK-----
+passphrase = secret
+comment = Example GPG key
+
+[usign]
+key = RWRCSwAAAADUvtjCkFEF4bWWxpPBo9o8R5FK6Rz5aPUsaZONLu8kxIjud9Fd+Mgu7J2fFJDVyKFAXNH6pKS+AuBW3v+TQT5m1J0W/JYTjqzIrgAZhRtm5v3vSKRl3HUD2zEEbG5j3tg=
+comment = Example usign key
+
+[slave 1]
+name = buildslave-phase2
+password = secret
+builds = 1
+cleanup = 1
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644 (file)
index 0000000..6a21469
--- /dev/null
@@ -0,0 +1,83 @@
+version: '2'
+
+services:
+  rsync-server:
+    build:
+      context: ../
+      dockerfile: docker/rsync/Dockerfile
+    image: rsync:latest
+    restart: always
+    cpuset: '0'
+    environment:
+      SHARE_USER: upload
+      SHARE_PASSWORD: secret
+    volumes:
+      - './build/output:/data'
+
+  buildmaster-phase1:
+    build:
+      context: ../
+      dockerfile: docker/buildmaster/Dockerfile
+    image: buildmaster:latest
+    restart: always
+    cpuset: '0'
+    environment:
+      BUILDMASTER_PHASE: 1
+      BUILDMASTER_CONFIG: /config.ini
+    ports:
+      - '8010:8010'
+      - '9989:9989'
+    volumes:
+      - './config.phase1.ini:/config.ini'
+      - './build/master-phase1:/master'
+
+  buildmaster-phase2:
+    build:
+      context: ../
+      dockerfile: docker/buildmaster/Dockerfile
+    image: buildmaster:latest
+    restart: always
+    cpuset: '0'
+    environment:
+      BUILDMASTER_PHASE: 2
+      BUILDMASTER_CONFIG: /config.ini
+    ports:
+      - '8011:8011'
+      - '9990:9990'
+    volumes:
+      - './config.phase2.ini:/config.ini'
+      - './build/master-phase2:/master'
+
+  buildslave-phase1:
+    build:
+      context: ../
+      dockerfile: docker/buildslave/Dockerfile
+    image: buildslave:latest
+    restart: always
+    cpuset: 1-3
+    environment:
+      BUILDSLAVE_MASTER: buildmaster-phase1:9989
+      BUILDSLAVE_NAME: buildslave-phase1
+      BUILDSLAVE_PASSWORD: secret
+    links:
+      - 'rsync-server'
+      - 'buildmaster-phase1'
+    volumes:
+      - './build/slave-phase1:/builder'
+
+  buildslave-phase2:
+    build:
+      context: ../
+      dockerfile: docker/buildslave/Dockerfile
+    image: buildslave:latest
+    restart: always
+    cpuset: 1-3
+    environment:
+      BUILDSLAVE_MASTER: buildmaster-phase2:9990
+      BUILDSLAVE_NAME: buildslave-phase2
+      BUILDSLAVE_PASSWORD: secret
+    links:
+      - 'rsync-server'
+      - 'buildmaster-phase2'
+    volumes:
+      - './build/slave-phase2:/builder'
diff --git a/docker/rsync/Dockerfile b/docker/rsync/Dockerfile
new file mode 100644 (file)
index 0000000..4c8ca34
--- /dev/null
@@ -0,0 +1,14 @@
+FROM debian:9
+
+COPY docker/rsync/files/entry.sh /entry.sh
+
+RUN apt-get update && \
+    apt-get -y install rsync && \
+    apt-get clean && \
+    mkdir -p /data && \
+    chmod 0755 /entry.sh
+
+EXPOSE 873
+VOLUME [ "/data" ]
+ENTRYPOINT [ "/entry.sh" ]
+HEALTHCHECK CMD xargs kill -0 < /tmp/rsyncd.pid
diff --git a/docker/rsync/files/entry.sh b/docker/rsync/files/entry.sh
new file mode 100644 (file)
index 0000000..9512a4a
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+(
+       echo "use chroot = yes"
+       echo "[${SHARE_NAME:-data}]"
+       echo "log file = /dev/null"
+       echo "uid = ${SHARE_UID:-1000}"
+       echo "gid = ${SHARE_GID:-1000}"
+       echo "path = /data"
+       echo "read only = false"
+       echo "write only = false"
+       echo "comment = ${SHARE_COMMENT:-Rsync data share}"
+
+       if [ -n "$SHARE_USER" -a -n "$SHARE_PASSWORD" ]; then
+               echo "auth users = $SHARE_USER"
+               echo "secrets file = /rsyncd.secrets"
+       fi
+) > /rsyncd.conf
+
+if [ -n "$SHARE_USER" -a -n "$SHARE_PASSWORD" ]; then
+       echo "$SHARE_USER:$SHARE_PASSWORD" > /rsyncd.secrets
+       chmod 0600 /rsyncd.secrets
+fi
+
+chown "${SHARE_UID:-1000}:${SHARE_GID:-1000}" /data
+
+exec /usr/bin/rsync --daemon --no-detach --config=/rsyncd.conf --log-file=/dev/stdout --dparam=pidfile=/tmp/rsyncd.pid "$@"