-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile.yaml
73 lines (59 loc) · 2.57 KB
/
dockerfile.yaml
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
66
67
68
69
70
71
72
73
# base image
FROM --platform=linux/amd64 ubuntu:20.04
#input GitHub runner version argument
ARG RUNNER_VERSION
ENV DEBIAN_FRONTEND=noninteractive
# ARG DOCKER_GID=999
LABEL Author="Nate D"
LABEL Email="nated@nated.ca"
LABEL GitHub="https://github.com/delduked"
LABEL BaseImage="ubuntu:20.04"
LABEL RunnerVersion=${RUNNER_VERSION}
# update the base packages + add a non-sudo user
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y gnupg2 apt-transport-https ca-certificates curl software-properties-common
ADD scripts/docker_installation.sh docker_installation.sh
RUN chmod +x docker_installation.sh && ./docker_installation.sh
# install kubectl cli tool
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
&& kubectl version --client
# install helm cli tool
ADD scripts/helm_installation.sh helm_installation.sh
RUN chmod +x helm_installation.sh \
&& ./helm_installation.sh \
&& helm version --client
# install the packages and dependencies along with jq so we can parse JSON (add additional packages as necessary)
RUN apt-get install -y --no-install-recommends \
wget unzip vim git jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip nodejs npm
# download and install golang
RUN wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz \
&& tar -xvf go1.22.1.linux-amd64.tar.gz \
&& mv go /usr/local
# Set up environment variables for Golang
ENV GOROOT /usr/local/go
ENV GOPATH $HOME/go
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
# cd into the user directory, download and unzip the github actions runner
RUN mkdir actions-runner \
&& curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
&& tar -xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz -C actions-runner \
&& rm actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
&& chmod +x ./actions-runner/bin/installdependencies.sh \
&& ./actions-runner/bin/installdependencies.sh
# add over the start.sh script
ADD scripts/start.sh start.sh
ADD scripts/key.pem key.pem
# make the script executable
RUN chmod +x start.sh
# Use the DOCKER_GID to create the docker group
RUN useradd -m gh && \
usermod -aG docker gh \
&& chown -R gh:gh /actions-runner \
&& touch /var/run/docker.sock \
&& chown -R gh:gh /var/run/docker.sock
RUN npm i -g @actions/github
USER gh
# set the entrypoint to the start.sh script
ENTRYPOINT ["./start.sh"]