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

Commit 07ff493

Browse files
committed
New dockerfile combining drone.io funtionality with supervisord process-manager
1 parent efd1ba3 commit 07ff493

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Nestybox's Drone system-container dockerfile.
2+
#
3+
# Description:
4+
#
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
8+
# through supervisord process manager.
9+
#
10+
# Requirements:
11+
#
12+
# 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:
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-server]
31+
# command=/bin/drone-server
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_GITHUB_SERVER=https://github.com \
42+
# --env=DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID} \
43+
# --env=DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_ID} \
44+
# --env=DRONE_RUNNER_CAPACITY=2 \
45+
# --env=DRONE_SERVER_HOST=${DRONE_SERVER_HOST} \
46+
# --env=DRONE_SERVER_PROTO=https \
47+
# --env=DRONE_TLS_AUTOCERT=true \
48+
# --env=DRONE_SERVER=http://${DRONE_SERVER_HOST} \
49+
# --env=DRONE_TOKEN=${DRONE_TOKEN} \
50+
# --env=DRONE_USER_CREATE=username:nestybox,admin:true,token:${DRONE_TOKEN} \
51+
# --publish=80:80 --publish=443:443 \
52+
# -d --rm --name=drone nestybox/ubuntu-bionic-docker-drone
53+
#
54+
# [ refer to Drone's official documentation for more details ]
55+
#
56+
57+
58+
#######################
59+
# Drone compilation #
60+
#######################
61+
62+
FROM golang:latest as golang
63+
RUN cd /root && \
64+
git clone https://github.com/drone/drone.git && \
65+
cd drone && \
66+
sh scripts/build.sh
67+
68+
RUN cd /root && \
69+
git clone https://github.com/drone/drone-cli.git && \
70+
cd drone-cli && \
71+
sh .drone.sh
72+
73+
74+
########################
75+
# Drone installation #
76+
########################
77+
78+
FROM ubuntu:bionic
79+
EXPOSE 80 443
80+
VOLUME /data
81+
82+
ENV GODEBUG netdns=go
83+
ENV XDG_CACHE_HOME /data
84+
ENV DRONE_DATABASE_DRIVER sqlite3
85+
ENV DRONE_DATABASE_DATASOURCE /data/database.sqlite
86+
ENV DRONE_RUNNER_OS=linux
87+
ENV DRONE_RUNNER_ARCH=amd64
88+
ENV DRONE_SERVER_PORT=:80
89+
ENV DRONE_SERVER_HOST=localhost
90+
ENV DRONE_DATADOG_ENABLED=true
91+
ENV DRONE_DATADOG_ENDPOINT=https://stats.drone.ci/api/v1/series
92+
93+
RUN apt-get update && \
94+
apt-get install -y --no-install-recommends ca-certificates && \
95+
rm -rf /var/lib/apt/lists/*
96+
97+
# Add previously built drone binaries.
98+
COPY --from=golang /root/drone/release/linux/drone-server /bin/
99+
COPY --from=golang /root/drone-cli/release/linux/amd64/drone /bin/
100+
101+
102+
#########################
103+
# Docker installation #
104+
#########################
105+
106+
RUN apt-get update && \
107+
apt-get install -y --no-install-recommends apt-transport-https \
108+
ca-certificates curl gnupg-agent software-properties-common && \
109+
rm -rf /var/lib/apt/lists/* && \
110+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
111+
apt-key fingerprint 0EBFCD88
112+
113+
RUN add-apt-repository \
114+
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
115+
$(lsb_release -cs) \
116+
stable"
117+
118+
RUN apt-get update && \
119+
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io && \
120+
rm -rf /var/lib/apt/lists/*
121+
122+
123+
##############################
124+
# Supervisord installation #
125+
##############################
126+
127+
RUN apt-get update && apt-get install -y --no-install-recommends supervisor && \
128+
rm -rf /var/lib/apt/lists/*
129+
130+
RUN mkdir -p /var/log/supervisor
131+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
132+
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-server]
14+
command=/bin/drone-server
15+
priority=2
16+
autostart=true
17+
autorestart=true
18+
startsecs=0

0 commit comments

Comments
 (0)