Compare commits

..
16 Commits
Author SHA1 Message Date
myoung34andGitHub 657f9b882c Update Dockerfile
Bump GH actions to 2.165.2
2020-02-12 13:52:25 -06:00
Marcus Young 2f3b19dbcb Update README from #7 2020-02-12 10:12:38 -06:00
myoung34andGitHub f7405e57af Merge pull request #6 from terradatum/master
Workflows target docker hub by Org/Account.
2020-02-11 14:26:44 -06:00
G. Richard Bellamy 6ccebdcc6d Make workflows target docker hub by organization/account.
IT-4071 #comment Make workflows target docker hub by organization/account.
2020-02-11 12:15:35 -08:00
G. Richard Bellamy 95be9f08b5 Make workflows target docker hub by organization/account.
IT-4071 #comment Install maven and npm - should go through the list of default utilities and tools installed into `ubuntu-latest` for parity with GitHub runners. Many actions will rely on and expect them.
IT-4071 #comment Because of https://bugs.launchpad.net/ubuntu/+source/nodejs/+bug/1794589, both libcurl4-openssl-dev and npm cannot be installed in bionic using the package. There are two options: 1) Use libcurl4-gnutls-dev rather than libcurl4-openssl-dev, 2) Install npm using the installation script from github. I choose option #2.
IT-4071 #comment Make workflows target docker hub by organization/account.
2020-02-10 13:48:32 -08:00
myoung34andGitHub 7a38b6d314 Update README.md 2020-02-06 07:13:17 -06:00
myoung34andGitHub f0a62e35dc Update README.md 2020-02-06 07:12:46 -06:00
myoung34andGitHub efdec6ab8c Merge pull request #5 from Pentusha/master
Multiarch builds fixed for #4
2020-02-05 13:42:42 -06:00
Ivan Larin 7d944a9917 Multiarch builds fixed for #4 2020-02-05 19:38:45 +03:00
myoung34andGitHub 000da19866 Bump to 2.165.1 2020-01-30 21:31:09 -06:00
Marcus Young c72e53dd91 Remove unneeded and fragile packages 2020-01-28 07:28:39 -06:00
Marcus Young 25ddc313e8 Simplify docker builds 2020-01-27 22:17:15 -06:00
myoung34andGitHub f48b16015a Merge pull request #3 from myoung34/2.165.0
Update to 2.165.0
2020-01-27 21:50:48 -06:00
myoung34andGitHub d40ef464fc Update Dockerfile.ubuntu-xenial 2020-01-27 21:49:21 -06:00
myoung34andGitHub 016a28caf7 Update Dockerfile.ubuntu-bionic 2020-01-27 21:48:38 -06:00
myoung34andGitHub add05adf31 Update Dockerfile.ubuntu 2020-01-27 21:47:32 -06:00
8 changed files with 122 additions and 112 deletions
+17 -5
View File
@@ -1,7 +1,9 @@
name: Publish Docker
name: GitHub Actions Runner in Docker - Latest
on:
push:
branches:
paths-ignore:
- README.md
branches:
- master
- develop
@@ -11,6 +13,8 @@ jobs:
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
@@ -21,12 +25,14 @@ jobs:
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu -t myoung34/github-runner:latest --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
run: docker buildx build -f Dockerfile -t ${ORG}/github-runner:latest --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_bionic_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
@@ -34,15 +40,19 @@ jobs:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-bionic -t myoung34/github-runner:ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
run: docker buildx build -f Dockerfile.ubuntu-bionic -t ${ORG}/github-runner:ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_xenial_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
@@ -50,7 +60,9 @@ jobs:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak 's/FROM.*/FROM ubuntu:xenial/' Dockerfile.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-xenial -t myoung34/github-runner:ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
run: docker buildx build -f Dockerfile.ubuntu-xenial -t ${ORG}/github-runner:ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
+22 -10
View File
@@ -1,17 +1,21 @@
name: Publish Docker
name: GitHub Actions Runner in Docker - Release
on:
push:
paths-ignore:
- README.md
tags:
- '*'
jobs:
ubuntu_tag_deploy:
ubuntu_latest_tag:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: get version
run: echo "::set-env name=TAG::$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")"
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
@@ -22,14 +26,16 @@ jobs:
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu -t myoung34/github-runner:${TAG} --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_bionic_deploy:
run: docker buildx build -f Dockerfile -t ${ORG}/github-runner:${TAG} --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_bionic_tag:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: get version
run: echo "::set-env name=TAG::$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")"
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
@@ -37,17 +43,21 @@ jobs:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-bionic -t myoung34/github-runner:${TAG}-ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_xenial_deploy:
run: docker buildx build -f Dockerfile.ubuntu-bionic -t ${ORG}/github-runner:${TAG}-ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_xenial_tag:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: get version
run: echo "::set-env name=TAG::$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")"
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
@@ -55,7 +65,9 @@ jobs:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak 's/FROM.*/FROM ubuntu:xenial/' Dockerfile.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-xenial -t myoung34/github-runner:${TAG}-ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
run: docker buildx build -f Dockerfile.ubuntu-xenial -t ${ORG}/github-runner:${TAG}-ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
+1
View File
@@ -0,0 +1 @@
*.bak
+4 -7
View File
@@ -2,7 +2,8 @@ FROM ubuntu:rolling
LABEL maintainer="3vilpenguin@gmail.com"
ARG GIT_VERSION="2.23.0"
ENV DEBIAN_FRONTEND=noninteractive
ARG GH_RUNNER_VERSION="2.165.2"
ARG TARGETPLATFORM
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3003
@@ -18,9 +19,7 @@ RUN apt-get update && \
build-essential \
zlib1g-dev \
gettext \
liblttng-ust-ctl4 \
liblttng-ust0 \
liburcu6 \
libcurl4-openssl-dev \
inetutils-ping \
&& rm -rf /var/lib/apt/lists/* \
@@ -38,16 +37,14 @@ RUN apt-get update && \
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& [[ $(lsb_release -cs) == "eoan" ]] && ( add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu disco stable" ) || ( add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" )\
&& apt-get update \
&& apt-get install -y docker-ce --no-install-recommends \
&& apt-get install -y docker-ce docker-ce-cli containerd.io --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /actions-runner
COPY install_actions.sh /actions-runner
# Put version here to prevent cache invalidation
ENV GH_RUNNER_VERSION="2.164.0"
RUN chmod +x /actions-runner/install_actions.sh \
&& /actions-runner/install_actions.sh ${GH_RUNNER_VERSION} \
&& /actions-runner/install_actions.sh ${GH_RUNNER_VERSION} ${TARGETPLATFORM} \
&& rm /actions-runner/install_actions.sh
WORKDIR /_work
-36
View File
@@ -1,36 +0,0 @@
FROM ubuntu:bionic
LABEL maintainer="3vilpenguin@gmail.com"
ARG GH_RUNNER_VERSION="2.163.1"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
tar \
git \
apt-transport-https \
ca-certificates \
sudo \
gnupg-agent \
software-properties-common \
inetutils-ping \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /actions-runner
RUN curl -O https://githubassets.azureedge.net/runners/${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& ./bin/installdependencies.sh \
&& mkdir /_work
WORKDIR /_work
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
-36
View File
@@ -1,36 +0,0 @@
FROM ubuntu:xenial
LABEL maintainer="3vilpenguin@gmail.com"
ARG GH_RUNNER_VERSION="2.163.1"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
tar \
git \
apt-transport-https \
ca-certificates \
sudo \
gnupg-agent \
software-properties-common \
inetutils-ping \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /actions-runner
RUN curl -O https://githubassets.azureedge.net/runners/${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& ./bin/installdependencies.sh \
&& mkdir /_work
WORKDIR /_work
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+71 -12
View File
@@ -15,23 +15,37 @@ This has been tested and verified on:
Manual:
```
docker run -it \
-e REPO_URL="https://github.com/myoung34/LEDSpicer" \
docker run -d --restart always --name github-runner \
-e REPO_URL="https://github.com/myoung34/repo" \
-e RUNNER_NAME="foo-runner" \
-e RUNNER_TOKEN="footoken" \
-e RUNNER_WORKDIR="/tmp/github-runner" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/github-runner:/tmp/github-runner \
myoung34/github-runner:latest
```
Or as an alias:
Or as a shell function (as root):
```
function run-server {
name=github-actions-$(echo $1 | sed 's/\//-/g')
function github-runner {
name=github-runner-${1//\//-}
org=$(dirname $1)
repo=$(basename $1)
tag=${3:-latest}
docker rm -f $name
docker run -d --restart=always -e REPO_URL="https://github.com/$1" -e RUNNER_TOKEN="$2" -v /var/run/docker.sock:/var/run/docker.sock --name $name github-runner:latest
docker run -d --restart=always \
-e REPO_URL="https://github.com/${org}/${repo}" \
-e RUNNER_TOKEN="$2" \
-e RUNNER_NAME="linux-${repo}" \
-e RUNNER_WORKDIR="/tmp/github-runner" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/github-runner:/tmp/github-runner \
--name $name ${org}/github-runner:${tag}
}
run-server your-account/your-repo AARGHTHISISYOURGHACTIONSTOKEN
run-server your-account/some-other-repo ARGHANOTHERGITHUBACTIONSTOKEN
github-runner your-account/your-repo AARGHTHISISYOURGHACTIONSTOKEN
github-runner your-account/some-other-repo ARGHANOTHERGITHUBACTIONSTOKEN ubuntu-xenial
```
Nomad:
@@ -45,22 +59,67 @@ job "github_runner" {
driver = "docker"
env {
REPO_URL = "https://github.com/myoung34/LEDSpicer"
RUNNER_TOKEN = "footoken"
REPO_URL = "https://github.com/your-account/your-repo"
RUNNER_TOKEN = "footoken"
RUNNER_WORKDIR = "/tmp/github-runner"
}
config {
privileged = true
image = "myoung34/github-runner:latest"
volumes = [
"/var/run/docker.sock:/var/run/docker.sock"
"/var/run/docker.sock:/var/run/docker.sock",
"/tmp/github-runner:/tmp/github-runner",
]
}
}
}
```
## Usage ##
Kubernetes:
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: actions-runner
namespace: runners
spec:
replicas: 1
selector:
matchLabels:
app: actions-runner
template:
metadata:
labels:
app: actions-runner
spec:
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
- name: workdir
hostPath:
path: /tmp/github-runner
containers:
containers:
- name: runner
image: myoung34/github-runner:latest
env:
- name: RUNNER_TOKEN
value: footoken
- name: REPO_URL
value: https://github.com/your-account/your-repo
- name: RUNNER_WORKDIR
value: /tmp/github-runner
volumeMounts:
- name: dockersock
mountPath: /var/run/docker.sock
- name: workdir
mountPath: /tmp/github-runner
```
## Usage From GH Actions Workflow ##
```
name: Package
+7 -6
View File
@@ -1,13 +1,14 @@
#!/bin/bash -x
GH_RUNNER_VERSION=$1
TARGETPLATFORM=$2
export ACTIONS_ARCH="x64"
if [[ $(dpkg --print-architecture) == "armhf" ]]; then
export ACTIONS_ARCH="arm"
elif [[ $(dpkg --print-architecture) == "arm64" ]]; then
export ACTIONS_ARCH="arm64"
export TARGET_ARCH="x64"
if [[ $TARGETPLATFORM == "linux/arm/v7" ]]; then
export TARGET_ARCH="arm"
elif [[ $TARGETPLATFORM == "linux/arm64" ]]; then
export TARGET_ARCH="arm64"
fi
curl -L "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz" > actions.tar.gz
curl -L "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-${TARGET_ARCH}-${GH_RUNNER_VERSION}.tar.gz" > actions.tar.gz
tar -zxf actions.tar.gz
rm -f actions.tar.gz
./bin/installdependencies.sh