Skip to content

Commit fbec252

Browse files
committed
upgrade to debian bullseye, remove docker from image, purge build dependecies within the build layer
1 parent 44ca552 commit fbec252

File tree

2 files changed

+26
-55
lines changed

2 files changed

+26
-55
lines changed

docker/Dockerfile

Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
ARG FROM=debian:buster-slim
1+
ARG FROM=debian:bullseye-slim
22
FROM ${FROM}
33

4-
ARG DEBIAN_FRONTEND=noninteractive
5-
ARG GIT_VERSION="2.26.2"
6-
ARG GH_RUNNER_VERSION
7-
ARG DOCKER_COMPOSE_VERSION="1.27.4"
8-
94
ENV RUNNER_NAME=""
105
ENV RUNNER_WORK_DIRECTORY="_work"
116
ENV RUNNER_TOKEN=""
@@ -27,63 +22,39 @@ LABEL maintainer="me@tcardonne.fr" \
2722
org.label-schema.vendor="Thomas Cardonne" \
2823
org.label-schema.docker.cmd="docker run -it tcardonne/github-runner:latest"
2924

30-
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
31-
apt-get install -y \
25+
RUN apt-get update && \
26+
apt-get install --assume-yes \
3227
curl \
33-
unzip \
34-
apt-transport-https \
35-
ca-certificates \
36-
software-properties-common \
37-
sudo \
28+
git \
3829
supervisor \
39-
jq \
40-
iputils-ping \
41-
build-essential \
42-
zlib1g-dev \
43-
gettext \
44-
liblttng-ust0 \
45-
libcurl4-openssl-dev \
46-
openssh-client && \
47-
rm -rf /var/lib/apt/lists/* && \
48-
apt-get clean
49-
50-
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
51-
RUN chmod 644 /etc/supervisor/conf.d/supervisord.conf
52-
53-
# Install Docker CLI
54-
RUN curl -fsSL https://get.docker.com -o- | sh && \
55-
rm -rf /var/lib/apt/lists/* && \
30+
jq && \
31+
rm --recursive --force /var/lib/apt/lists/* && \
5632
apt-get clean
5733

58-
# Install Docker-Compose
59-
RUN curl -L -o /usr/local/bin/docker-compose \
60-
"https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" && \
61-
chmod +x /usr/local/bin/docker-compose
62-
63-
RUN cd /tmp && \
64-
curl -sL -o git.tgz \
65-
https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz && \
66-
tar zxf git.tgz && \
67-
cd git-${GIT_VERSION} && \
68-
./configure --prefix=/usr && \
69-
make && \
70-
make install && \
71-
rm -rf /tmp/*
72-
73-
RUN mkdir -p /home/runner ${AGENT_TOOLSDIRECTORY}
34+
RUN mkdir --parents /home/runner ${AGENT_TOOLSDIRECTORY}
7435

7536
WORKDIR /home/runner
7637

77-
RUN GH_RUNNER_VERSION=${GH_RUNNER_VERSION:-$(curl --silent "https://api.github.com/repos/actions/runner/releases/latest" | grep tag_name | sed -E 's/.*"v([^"]+)".*/\1/')} \
78-
&& curl -L -O https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
79-
&& tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
80-
&& rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
81-
&& ./bin/installdependencies.sh \
82-
&& chown -R root: /home/runner \
83-
&& rm -rf /var/lib/apt/lists/* \
84-
&& apt-get clean
38+
ARG GH_RUNNER_VERSION
39+
RUN set -x && \
40+
apt-get update && \
41+
packages="build-essential zlib1g-dev liblttng-ust0 libcurl4-openssl-dev openssh-client" && \
42+
apt-get install --assume-yes ${packages} && \
43+
GH_RUNNER_VERSION=${GH_RUNNER_VERSION:-$(curl --silent "https://api.github.com/repos/actions/runner/releases/latest" | jq -r .tag_name | sed -E 's/v([^"]+)/\1/')} && \
44+
curl --fail --show-error --location --remote-name https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz && \
45+
tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz && \
46+
rm actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz && \
47+
./bin/installdependencies.sh && \
48+
chown --recursive root: /home/runner && \
49+
apt-get purge --assume-yes --auto-remove ${packages} && \
50+
rm --recursive --force /var/lib/apt/lists/* && \
51+
apt-get clean
52+
53+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
54+
RUN chmod 644 /etc/supervisor/conf.d/supervisord.conf
8555

8656
COPY entrypoint.sh /entrypoint.sh
8757
RUN chmod +x /entrypoint.sh
58+
8859
ENTRYPOINT ["/entrypoint.sh"]
8960
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

docker/hooks/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -ex
88
# DOCKER_TAG can be : latest, ubuntu-20.04, v1.0.0, v1.0.0-ubuntu-20.04
99

1010
if [[ $DOCKER_TAG =~ ^(latest|v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
11-
TAG=debian-buster-slim
11+
TAG=debian-bullseye-slim
1212
else
1313
# Remove vX.X.X- suffix
1414
TAG=$(echo $DOCKER_TAG | sed 's/v[0-9]\+.[0-9]\+.[0-9]\+-//')

0 commit comments

Comments
 (0)