Skip to content

Commit 3dbd5c8

Browse files
authored
Merge pull request #9 from github-developer/fix/issues/4
Fixes for issues/4
2 parents 3347c9b + ea7fd4e commit 3dbd5c8

3 files changed

Lines changed: 29 additions & 28 deletions

File tree

Dockerfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM ubuntu:18.04
44
RUN apt-get update
55
RUN apt-get install -y libssl-dev curl iputils-ping jq wget
66

7-
# Docker in docker for container builds on Kubernetes. Otherwise, follow this guidance: https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/.
7+
# Download Docker for container builds on Kubernetes
88
ENV DOCKER_CHANNEL stable
99
ENV DOCKER_VERSION 18.09.1
1010
RUN wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" && \
@@ -15,8 +15,19 @@ RUN wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNE
1515
RUN mkdir ./actions-runner
1616
WORKDIR /home/actions-runner
1717

18-
COPY startup.sh .
18+
# Download Actions runner
19+
# https://github.com/terraform-google-modules/terraform-google-github-actions-runners/blob/598a38a72b7bbaf56be431c07de04752c521fd60/examples/gh-runner-gke-dind/Dockerfile#L28-L31
20+
ARG GH_RUNNER_VERSION="2.169.1"
21+
RUN curl -o actions.tar.gz --location "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz" && \
22+
tar -zxf actions.tar.gz && \
23+
rm -f actions.tar.gz
24+
25+
# Install dependencies
26+
RUN ./bin/installdependencies.sh
1927

20-
EXPOSE 8080
28+
# Allow runner to run as root
29+
ENV RUNNER_ALLOW_RUNASROOT=1
30+
31+
COPY startup.sh .
2132

2233
ENTRYPOINT ["./startup.sh"]

deployment.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,18 @@ spec:
3535
# Docker-in-Docker not recommended for production
3636
- name: dind
3737
image: docker:18.09-dind
38+
resources:
39+
requests:
40+
memory: "512Mi"
41+
cpu: "500m"
42+
limits:
43+
memory: "1024Mi"
44+
cpu: "1"
3845
securityContext:
39-
privileged: true
46+
privileged: true
47+
volumeMounts:
48+
- name: dind-storage
49+
mountPath: /var/lib/docker
50+
volumes:
51+
- name: dind-storage
52+
emptyDir: {}

startup.sh

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,11 @@ function remove_runner {
1111
# Watch for EXIT signal to be able to shut down gracefully
1212
trap remove_runner EXIT
1313

14-
echo "## Finding latest release binary for Linux x64..."
15-
16-
# Get latest binary version for Linux x64
17-
BINARY_URL=$(curl \
18-
--url https://api.github.com/repos/$GITHUB_REPO/actions/runners/downloads \
19-
--header "authorization: Bearer $TOKEN" | \
20-
jq -r '.[] | select(.os=="linux") | select(.architecture=="x64") | .download_url')
21-
22-
echo "## Downloading ${BINARY_URL}..."
23-
24-
# Follow any redirects to download and unpack the binary
25-
curl -L $BINARY_URL | tar xz
26-
27-
echo "## Finished downloading ${BINARY_URL}."
28-
2914
# Generate
3015
CONFIG_TOKEN=$(curl --data "" --header "Authorization: Bearer $TOKEN" https://api.github.com/repos/$GITHUB_REPO/actions/runners/registration-token | jq -r '.token')
3116

32-
echo "Installing dependencies..."
33-
34-
# Install dependencies
35-
./bin/installdependencies.sh
36-
37-
# Allow runner to run as root
38-
export RUNNER_ALLOW_RUNASROOT=1
39-
4017
# Create the runner and configure it
4118
./config.sh --url https://github.com/$GITHUB_REPO --token $CONFIG_TOKEN --unattended
4219

4320
# Run it
44-
./run.sh
21+
./runsvc.sh

0 commit comments

Comments
 (0)