Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 5d50a0d

Browse files
committed
Separate drone dockerfile into 'server' and 'agent' entities
1 parent c2bb183 commit 5d50a0d

File tree

4 files changed

+149
-11
lines changed

4 files changed

+149
-11
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Nestybox's Drone-agent Dockerfile.
2+
#
3+
# Description:
4+
#
5+
# Dockerfile to construct a system container hosting Drone-agent functionality.
6+
# The obtained image will incorporate the drone-agent binary, as well as the
7+
# Docker package required to instantiate 'slave' containers to execute continous
8+
# integration tasks. Both daemons (drone-agent and dockerd) will be managed
9+
# through supervisord process manager.
10+
#
11+
# Requirements:
12+
#
13+
# A supervisord.conf file in charge of launching dockerd & drone-agent daemons,
14+
# must be provided as part of this image compilation process. See example below:
15+
#
16+
# ---
17+
# $ cat supervisord.conf
18+
# [supervisord]
19+
# stdout_logfile=/dev/stdout
20+
# stdout_logfile_maxbytes=0
21+
# nodaemon=true
22+
#
23+
# [program:dockerd]
24+
# command=/usr/bin/dockerd
25+
# priority=1
26+
# autostart=true
27+
# autorestart=true
28+
# startsecs=0
29+
#
30+
# [program:drone-agent]
31+
# command=/bin/drone-agent
32+
# priority=2
33+
# autostart=true
34+
# autorestart=true
35+
# startsecs=0
36+
# ---
37+
#
38+
# Container initialization:
39+
#
40+
# $ docker run --runtime=sysbox-runc \
41+
# --env=DRONE_SERVER_HOST=my-drone.server.com:80 \
42+
# --env=DRONE_RPC_SECRET=my-secret \
43+
# -d --rm --name=drone nestybox/ubuntu-bionic-drone-agent
44+
#
45+
# [ refer to Drone's official documentation for more details ]
46+
#
47+
48+
49+
#######################
50+
# Drone compilation #
51+
#######################
52+
53+
FROM golang:latest as golang
54+
RUN cd /root && \
55+
git clone https://github.com/drone/drone.git && \
56+
cd drone && \
57+
sh scripts/build.sh
58+
59+
RUN cd /root && \
60+
git clone https://github.com/drone/drone-cli.git && \
61+
cd drone-cli && \
62+
sh .drone.sh
63+
64+
65+
########################
66+
# Drone installation #
67+
########################
68+
69+
FROM ubuntu:bionic
70+
EXPOSE 80 443
71+
VOLUME /data
72+
73+
ENV GODEBUG netdns=go
74+
ENV XDG_CACHE_HOME /data
75+
ENV DRONE_DATABASE_DRIVER sqlite3
76+
ENV DRONE_DATABASE_DATASOURCE /data/database.sqlite
77+
ENV DRONE_RUNNER_OS=linux
78+
ENV DRONE_RUNNER_ARCH=amd64
79+
ENV DRONE_SERVER_PORT=:80
80+
ENV DRONE_SERVER_HOST=localhost
81+
ENV DRONE_DATADOG_ENABLED=true
82+
ENV DRONE_DATADOG_ENDPOINT=https://stats.drone.ci/api/v1/series
83+
84+
85+
RUN apt-get update && \
86+
apt-get install -y --no-install-recommends ca-certificates && \
87+
rm -rf /var/lib/apt/lists/*
88+
89+
# Add previously built drone binaries.
90+
COPY --from=golang /root/drone/release/linux/drone-agent /bin/
91+
COPY --from=golang /root/drone-cli/release/linux/amd64/drone /bin/
92+
93+
94+
#########################
95+
# Docker installation #
96+
#########################
97+
98+
RUN apt-get update && \
99+
apt-get install -y --no-install-recommends apt-transport-https \
100+
ca-certificates curl gnupg-agent software-properties-common && \
101+
rm -rf /var/lib/apt/lists/* && \
102+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
103+
apt-key fingerprint 0EBFCD88
104+
105+
RUN add-apt-repository \
106+
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
107+
$(lsb_release -cs) \
108+
stable"
109+
110+
RUN apt-get update && \
111+
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io && \
112+
rm -rf /var/lib/apt/lists/*
113+
114+
115+
##############################
116+
# Supervisord installation #
117+
##############################
118+
119+
RUN apt-get update && apt-get install -y --no-install-recommends supervisor && \
120+
rm -rf /var/lib/apt/lists/*
121+
122+
RUN mkdir -p /var/log/supervisor
123+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
124+
CMD ["/usr/bin/supervisord"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[supervisord]
2+
stdout_logfile=/dev/stdout
3+
stdout_logfile_maxbytes=0
4+
nodaemon=true
5+
6+
[program:dockerd]
7+
command=/usr/bin/dockerd
8+
priority=1
9+
autostart=true
10+
autorestart=true
11+
startsecs=0
12+
13+
[program:drone-agent]
14+
command=/bin/drone-agent
15+
priority=2
16+
autostart=true
17+
autorestart=true
18+
startsecs=0

dockerfiles/ubuntu-bionic-docker-drone/Dockerfile renamed to dockerfiles/ubuntu-bionic-drone/server/Dockerfile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Nestybox's Drone system-container dockerfile.
1+
# Nestybox's Drone-server Dockerfile.
22
#
33
# Description:
44
#
5-
# Image's purpose is to provide a full-fledge Drone CI/CD system. Obtained image
6-
# will incorporate all the necessary Drone binaries, as well as the dockerd
7-
# binary required to instantiate 'inner' containers. Both daemons will be managed
5+
# Dockerfile to construct a system container to host Drone-server functionality.
6+
# The obtained image will incorporate the drone-server binary, as well as the
7+
# Docker package required to instantiate 'slave' containers to execute continous
8+
# integration tasks. Both daemons (drone-server and dockerd) will be managed
89
# through supervisord process manager.
910
#
1011
# Requirements:
1112
#
1213
# A supervisord.conf file in charge of launching dockerd & drone-server daemons,
13-
# must be provided as part of this docker image compilation process. See example
14-
# below:
14+
# must be provided as part of this image compilation process. See example below:
1515
#
1616
# ---
1717
# $ cat supervisord.conf
@@ -41,15 +41,11 @@
4141
# --env=DRONE_GITHUB_SERVER=https://github.com \
4242
# --env=DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID} \
4343
# --env=DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_ID} \
44-
# --env=DRONE_RUNNER_CAPACITY=2 \
4544
# --env=DRONE_SERVER_HOST=${DRONE_SERVER_HOST} \
46-
# --env=DRONE_SERVER_PROTO=https \
47-
# --env=DRONE_TLS_AUTOCERT=true \
4845
# --env=DRONE_SERVER=http://${DRONE_SERVER_HOST} \
49-
# --env=DRONE_TOKEN=${DRONE_TOKEN} \
5046
# --env=DRONE_USER_CREATE=username:nestybox,admin:true,token:${DRONE_TOKEN} \
5147
# --publish=80:80 --publish=443:443 \
52-
# -d --rm --name=drone nestybox/ubuntu-bionic-docker-drone
48+
# -d --rm --name=drone nestybox/ubuntu-bionic-drone-server
5349
#
5450
# [ refer to Drone's official documentation for more details ]
5551
#
File renamed without changes.

0 commit comments

Comments
 (0)