-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (49 loc) · 2.14 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM ubuntu:20.04
ARG TINI_VERSION='0.19.0'
ARG RUNNER_VERSION=2.305.0
ENV RUNNER_CONFIG_ARGS='--url https://github.com/foo/bar --token BAZ'
ENV TZ='Europe/Chisinau'
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
RUN apt update \
# tzdata
&& truncate -s0 /tmp/preseed.cfg \
&& echo "tzdata tzdata/Areas select Europe" >> /tmp/preseed.cfg \
&& echo "tzdata tzdata/Zones/Europe select Chisinau" >> /tmp/preseed.cfg \
&& debconf-set-selections /tmp/preseed.cfg \
&& rm -f /etc/timezone /etc/localtime \
&& apt-get install -y tzdata \
&& apt install -y \
curl wget htop ssh iputils-ping git nano sudo ca-certificates apt-transport-https gnupg-agent software-properties-common \
&& (curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -) \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt update \
&& apt install -y docker-ce docker-ce-cli containerd.io \
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/*
ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini
RUN chmod +x /tini
RUN adduser --disabled-password --gecos '' github \
# allow docker without sudo
&& usermod -aG docker github \
&& usermod -aG sudo github \
# allow sudo without password
&& sed -i 's/%sudo\s.*/%sudo ALL=(ALL:ALL) NOPASSWD : ALL/g' /etc/sudoers
RUN mkdir -p /home/github/runner
WORKDIR /home/github/runner
RUN wget https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
-O runner.tar.gz -q \
&& tar -xf runner.tar.gz \
&& rm runner.tar.gz \
&& chown -R github:github *
RUN ./bin/installdependencies.sh \
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/* \
&& chown github:github /home/github/runner
USER github
RUN mkdir -p ~/.ssh \
&& ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts \
&& ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
USER root
COPY docker-entrypoint.sh /usr/bin/
VOLUME [ "/home/github/runner" ]
ENTRYPOINT ["/tini", "docker-entrypoint.sh", "--"]
CMD []