fix(workflows): update actions/setup-go to v2 (#14)

This commit is contained in:
Ryan (hackercat)
2021-06-14 22:30:46 +00:00
committed by GitHub
parent 93fbe6ae61
commit 405652dcda
12 changed files with 282 additions and 172 deletions
+6 -6
View File
@@ -21,7 +21,7 @@ env:
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
jobs: jobs:
build: build-alpine:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: Images environment: Images
steps: steps:
@@ -81,7 +81,7 @@ jobs:
quay.io/${{ env.SLUG }}:${{ env.TAG }} quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }} docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: | build-args: |
IMAGEOS=${{ env.IMAGE }} DISTRO=${{ env.IMAGE }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }} BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=act BUILD_TAG=act
BUILD_REF=${{ github.sha }} BUILD_REF=${{ github.sha }}
@@ -101,13 +101,13 @@ jobs:
docker.io/${{ env.SLUG }}:${{ env.TAG }} docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: | build-args: |
IMAGE=ghcr.io/${{ env.SLUG }} IMAGE=ghcr.io/${{ env.SLUG }}
IMAGEOS=${{ env.IMAGE }} DISTRO=${{ env.IMAGE }}
TAG=act-${{ steps.print-tag.outputs.tag }} TAG=act-${{ steps.print-tag.outputs.tag }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }} BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=runner BUILD_TAG=runner
BUILD_REF=${{ github.sha }} BUILD_REF=${{ github.sha }}
- uses: actions/setup-go@v1 - uses: actions/setup-go@v2
with: with:
go-version: 1.16 go-version: 1.16
@@ -139,7 +139,7 @@ jobs:
quay.io/${{ env.SLUG }}:${{ env.TAG }} quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }} docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: | build-args: |
IMAGEOS=${{ env.IMAGE }} DISTRO=${{ env.IMAGE }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }} BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=${{ env.TAG }} BUILD_TAG=${{ env.TAG }}
BUILD_REF=${{ github.sha }} BUILD_REF=${{ github.sha }}
@@ -159,7 +159,7 @@ jobs:
docker.io/${{ env.SLUG }}:${{ env.TAG }} docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: | build-args: |
IMAGE=ghcr.io/${{ env.SLUG }} IMAGE=ghcr.io/${{ env.SLUG }}
IMAGEOS=${{ env.IMAGE }} DISTRO=${{ env.IMAGE }}
TAG=act-${{ steps.print-tag.outputs.tag }} TAG=act-${{ steps.print-tag.outputs.tag }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }} BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=${{ env.TAG }} BUILD_TAG=${{ env.TAG }}
+123 -86
View File
@@ -18,13 +18,21 @@ on:
env: env:
SLUG: ${{ github.repository_owner }}/ubuntu SLUG: ${{ github.repository_owner }}/ubuntu
IMAGE: ubuntu IMAGE: ubuntu
PLATFORMS: linux/amd64,linux/arm64 PLATFORMS: linux/amd64
NODE: '12' NODE: '12'
BUILD_REF: ${{ github.sha }}
SKIP_TEST: true
defaults:
run:
shell: sh
jobs: jobs:
build: build-base:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: Images environment: Images
env:
PLATFORMS: linux/amd64,linux/arm64
strategy: strategy:
fail-fast: true fail-fast: true
max-parallel: 4 max-parallel: 4
@@ -55,24 +63,21 @@ jobs:
password: ${{ secrets.DOCKER_TOKEN }} password: ${{ secrets.DOCKER_TOKEN }}
- name: Print tag - name: Print tag
id: print-tag
shell: sh
run: | run: |
if ${{ github.event_name == 'pull_request' }} && ${{ !env.ACT }} ; then if ${{ github.event_name == 'pull_request' }} && ${{ !env.ACT }} ; then
echo "::set-output name=tag::PR-${{ github.event.number }}" echo "PART_TAG=PR-${{ github.event.number }}" >> $GITHUB_ENV
elif ${{ !env.ACT }} ; then elif ${{ !env.ACT }} ; then
echo "::set-output name=tag::$(date +%Y%m%d)" echo "PART_TAG=$(date +%Y%m%d)" >> $GITHUB_ENV
else else
echo "::set-output name=tag::dev" echo "PART_TAG=dev" >> $GITHUB_ENV
fi fi
- name: Set Ubuntu version to RELEASE - name: Set Ubuntu version to RELEASE
id: print-release
run: | run: |
if [ "latest" = "${{ matrix.TAG }}" ]; then if [ "latest" = "${{ matrix.TAG }}" ]; then
echo "::set-output name=RELEASE::$(lsb_release -rs)" echo "RELEASE_TAG=$(lsb_release -rs)" >> $GITHUB_ENV
else else
echo "::set-output name=RELEASE::${{ matrix.TAG }}" echo "RELEASE_TAG=${{ matrix.TAG }}" >> $GITHUB_ENV
fi fi
- name: Set up QEMU - name: Set up QEMU
@@ -84,101 +89,133 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }} - name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2 run: ./build.sh
env: env:
TAG: act-${{ matrix.TAG }}-${{ steps.print-tag.outputs.tag }} TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
with: TYPE: act
context: . FROM_IMAGE: buildpack-deps
push: true FROM_TAG: ${{ env.RELEASE_TAG }}
file: ./linux/${{ env.IMAGE }}/act/Dockerfile DISTRO: ${{ env.IMAGE }}
platforms: ${{ env.PLATFORMS }} BUILD_TAG_VERSION: ${{ env.PART_TAG }}
tags: | BUILD_TAG: act-${{ matrix.TAG }}
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
IMAGEOS=${{ env.IMAGE }}
NODE_VERSION=${{ env.NODE }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=act-${{ matrix.TAG }}
BUILD_REF=${{ github.sha }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }} - name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2 run: ./build.sh
env: env:
TAG: runner-${{ matrix.TAG }}-${{ steps.print-tag.outputs.tag }} TAG: runner-${{ matrix.TAG }}-${{ env.PART_TAG }}
with: TYPE: runner
context: . DISTRO: ${{ env.IMAGE }}
push: true FROM_IMAGE: ghcr.io/${{ env.SLUG }}
file: ./linux/${{ env.IMAGE }}/runner/Dockerfile FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
platforms: ${{ env.PLATFORMS }} BUILD_TAG_VERSION: ${{ env.PART_TAG }}
tags: | BUILD_TAG: runner-${{ matrix.TAG }}
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
IMAGE=ghcr.io/${{ env.SLUG }}
IMAGEOS=${{ env.IMAGE }}
TAG=act-${{ matrix.TAG }}-${{ steps.print-tag.outputs.tag }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=runner
BUILD_REF=${{ github.sha }}
- uses: actions/setup-go@v1 - uses: actions/setup-go@v2
with: with:
go-version: 1.16 go-version: 1.16
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
ref: cat/fix/change-image repository: nektos/act
repository: catthehacker/act-fork
path: act path: act
- env: - if: ${{ !env.SKIP_TEST }}
ACT_TEST_IMAGE: ghcr.io/${{ env.SLUG }}:act-${{ matrix.TAG }}-${{ steps.print-tag.outputs.tag }} env:
ACT_REPOSITORY: catthehacker/act-fork ACT_TEST_IMAGE: ghcr.io/${{ env.SLUG }}:act-${{ matrix.TAG }}-${{ env.PART_TAG }}
ACT_OWNER: catthehacker
run: | run: |
cd act/ cd act/
go test ./... go test ./...
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }} - name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2 if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
run: ./build.sh
env: env:
TAG: act TAG: act-${{ matrix.TAG }}
with: TYPE: act
context: . FROM_IMAGE: buildpack-deps
push: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }} FROM_TAG: ${{ env.RELEASE_TAG }}
file: ./linux/${{ env.IMAGE }}/act/Dockerfile DISTRO: ${{ env.IMAGE }}
platforms: ${{ env.PLATFORMS }} BUILD_TAG_VERSION: ${{ env.PART_TAG }}
tags: | BUILD_TAG: act-${{ matrix.TAG }}
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
NODE_VERSION=${{ env.NODE }}
IMAGEOS=${{ env.IMAGE }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=act-${{ matrix.TAG }}
BUILD_REF=${{ github.sha }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }} - name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2 if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
run: ./build.sh
shell: sh
env: env:
TAG: runner TAG: runner-${{ matrix.TAG }}
TYPE: runner
DISTRO: ${{ env.IMAGE }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: runner-${{ matrix.TAG }}
build-flavours:
runs-on: ubuntu-latest
needs: [build-base]
strategy:
fail-fast: true
max-parallel: 4
matrix:
TAG: [latest, 20.04, 18.04, 16.04]
TYPE: [js, rust]
steps:
- name: Login to GitHub Container Registry
id: ghcr
uses: docker/login-action@v1
with: with:
context: . registry: ghcr.io
push: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }} username: ${{ github.repository_owner }}
file: ./linux/${{ env.IMAGE }}/runner/Dockerfile password: ${{ secrets.GITHUB_TOKEN }}
platforms: ${{ env.PLATFORMS }}
tags: | - name: Login to Quay
ghcr.io/${{ env.SLUG }}:${{ env.TAG }} id: quay
quay.io/${{ env.SLUG }}:${{ env.TAG }} uses: docker/login-action@v1
docker.io/${{ env.SLUG }}:${{ env.TAG }} with:
build-args: | registry: quay.io
IMAGE=ghcr.io/${{ env.SLUG }} username: ${{ secrets.QUAY_USER }}
IMAGEOS=${{ env.IMAGE }} password: ${{ secrets.QUAY_TOKEN }}
TAG=act-${{ matrix.TAG }}-${{ steps.print-tag.outputs.tag }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }} - name: Login to Docker Hub
BUILD_TAG=runner-${{ matrix.TAG }} id: dckr
BUILD_REF=${{ github.sha }} uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Print tag
run: |
if ${{ github.event_name == 'pull_request' }} && ${{ !env.ACT }} ; then
echo "PART_TAG=PR-${{ github.event.number }}" >> $GITHUB_ENV
elif ${{ !env.ACT }} ; then
echo "PART_TAG=$(date +%Y%m%d)" >> $GITHUB_ENV
else
echo "PART_TAG=dev" >> $GITHUB_ENV
fi
- name: Set Ubuntu version to RELEASE
run: |
if [ "latest" = "${{ matrix.TAG }}" ]; then
echo "RELEASE_TAG=$(lsb_release -rs)" >> $GITHUB_ENV
else
echo "RELEASE_TAG=${{ matrix.TAG }}" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
run: ./build.sh
env:
TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}-${{ env.PART_TAG }}
TYPE: ${{ matrix.TYPE }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}
DISTRO: ${{ env.IMAGE }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}
-2
View File
@@ -1,5 +1,3 @@
build.ps1
# custom stuff # custom stuff
.secrets .secrets
.env .env
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 catthehacker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Symlink
+1
View File
@@ -0,0 +1 @@
LICENCE
+7 -2
View File
@@ -1,7 +1,10 @@
# Docker images # Docker images
[![Build Docker image](https://github.com/CatTheHacker/docker-images/workflows/Build%20Docker%20image/badge.svg)](https://github.com/CatTheHacker/docker-images/actions?query=workflow%3A%22Build+Docker+image%22) [![Scheduled build (Ubuntu)](https://github.com/catthehacker/docker_images/actions/workflows/build-ubuntu.yml/badge.svg?event=schedule)](https://github.com/catthehacker/docker_images/actions/workflows/build-ubuntu.yml)
[![GitHub Super-Linter](https://github.com/catthehacker/docker_images/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter) [![On-demand build (Ubuntu)](https://github.com/catthehacker/docker_images/actions/workflows/build-ubuntu.yml/badge.svg?event=workflow_dispatch)](https://github.com/catthehacker/docker_images/actions/workflows/build-ubuntu.yml)
[![Scheduled build (Alpine)](https://github.com/catthehacker/docker_images/actions/workflows/build-alpine.yml/badge.svg?event=schedule)](https://github.com/catthehacker/docker_images/actions/workflows/build-alpine.yml)
[![On-demand build (Alpine)](https://github.com/catthehacker/docker_images/actions/workflows/build-alpine.yml/badge.svg?event=workflow_dispatch)](https://github.com/catthehacker/docker_images/actions/workflows/build-alpine.yml)
[![Linter](https://github.com/catthehacker/docker_images/actions/workflows/lint.yml/badge.svg)](https://github.com/catthehacker/docker_images/actions/workflows/lint.yml)
## When updates will be applied to images ## When updates will be applied to images
@@ -36,5 +39,7 @@
- `catthehacker/alpine:act` - `catthehacker/alpine:act`
- `catthehacker/alpine:runner` - `catthehacker/alpine:runner`
## Repository contains parts of [`actions/virtual-environments`][actions/virtual-environments] which is licenced under ["MIT License"](https://github.com/actions/virtual-environments/blob/main/LICENSE)
[actions/virtual-environments]: https://github.com/actions/virtual-environments [actions/virtual-environments]: https://github.com/actions/virtual-environments
[catthehacker/runner-image]: https://github.com/catthehacker/virtual-environments [catthehacker/runner-image]: https://github.com/catthehacker/virtual-environments
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
docker buildx build \
--pull \
--push \
--progress=plain \
--tag="ghcr.io/${SLUG}:${TAG}" \
--tag="quay.io/${SLUG}:${TAG}" \
--tag="docker.io/${SLUG}:${TAG}" \
--build-arg="NODE_VERSION=${NODE}" \
--build-arg="DISTRO=${DISTRO}" \
--build-arg="BUILD_TAG_VERSION=${BUILD_TAG_VERSION}" \
--build-arg="BUILD_TAG=${BUILD_TAG}" \
--build-arg="BUILD_REF=${BUILD_REF}" \
--build-arg="FROM_IMAGE=${FROM_IMAGE}" \
--build-arg="FROM_TAG=${FROM_TAG}" \
--file="./linux/${IMAGE}/${TYPE}/Dockerfile" \
--platform="${PLATFORMS}" \
.
+1
View File
@@ -17,6 +17,7 @@ SHELL [ "/bin/ash", "-l", "-o", "pipefail", "-c" ]
RUN set -euxo pipefail \ RUN set -euxo pipefail \
&& printf "\n\n\t🐋\t Build started \t🐋\t\n\n" \ && printf "\n\n\t🐋\t Build started \t🐋\t\n\n" \
&& printf "\n\n\t🐋\t Adding environment variables \t🐋\t\n\n" \ && printf "\n\n\t🐋\t Adding environment variables \t🐋\t\n\n" \
&& sed 's|"||g' -i /etc/environment \
&& echo "USER=$(whoami)" | tee -a /etc/environment \ && echo "USER=$(whoami)" | tee -a /etc/environment \
&& echo "RUNNER_USER=$(whoami)" | tee -a /etc/environment \ && echo "RUNNER_USER=$(whoami)" | tee -a /etc/environment \
&& echo "IMAGE_OS=${IMAGE}" | tee -a /etc/environment \ && echo "IMAGE_OS=${IMAGE}" | tee -a /etc/environment \
+44 -40
View File
@@ -1,18 +1,20 @@
ARG IMAGE=buildpack-deps ARG FROM_IMAGE=buildpack-deps
ARG TAG=20.04 ARG FROM_TAG=20.04
FROM ${IMAGE}:${TAG} FROM ${FROM_IMAGE}:${FROM_TAG}
# > automatic buildx ARGs # > automatic buildx ARGs
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT
# > ARGs before FROM are not accessible # > ARGs before FROM are not accessible
ARG IMAGE=buildpack-deps ARG FROM_IMAGE=buildpack-deps
ARG TAG=20.04 ARG FROM_TAG=20.04
# > NodeJS version # > NodeJS version
ARG NODE_VERSION=12 ARG NODE_VERSION=12
# > Distro
ARG DISTRO=ubuntu
# > Force apt to not be interactive/not ask # > Force apt to not be interactive/not ask
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
@@ -20,53 +22,55 @@ SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ]
# > setup environment required for GitHub Actions # > setup environment required for GitHub Actions
RUN set -Eeuxo pipefail \ RUN set -Eeuxo pipefail \
&& printf "\n\n\t🐋\t Build started \t🐋\t\n\n" \ && printf "\n\n\t🐋 Build started 🐋\t\n\n" \
&& sed 's|"||g' -i /etc/environment \
&& echo "USER=$(whoami)" | tee -a /etc/environment \ && echo "USER=$(whoami)" | tee -a /etc/environment \
&& echo "RUNNER_USER=$(whoami)" | tee -a /etc/environment \ && echo "RUNNER_USER=$(whoami)" | tee -a /etc/environment \
&& ImageOS=ubuntu$(echo ${TAG} | cut -d'.' -f 1) \ && ImageOS=ubuntu$(echo ${FROM_TAG} | cut -d'.' -f 1) \
&& echo "IMAGE_OS=$ImageOS" | tee -a /etc/environment \ && echo "IMAGE_OS=$ImageOS" | tee -a /etc/environment \
&& echo "ImageOS=$ImageOS" | tee -a /etc/environment \ && echo "ImageOS=$ImageOS" | tee -a /etc/environment \
&& echo "LSB_RELEASE=${TAG}" | tee -a /etc/environment \ && echo "LSB_RELEASE=${FROM_TAG}" | tee -a /etc/environment \
&& AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache \ && AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache \
&& echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment \ && echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment \
&& echo "RUN_TOOL_CACHE=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment \ && echo "RUN_TOOL_CACHE=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment \
&& echo "DEPLOYMENT_BASEPATH=/opt/runner" | tee -a /etc/environment \ && echo "DEPLOYMENT_BASEPATH=/opt/runner" | tee -a /etc/environment \
&& echo ". /etc/environment" | tee -a /etc/profile \ && echo ". /etc/environment" | tee -a /etc/profile \
&& mkdir -p $AGENT_TOOLSDIRECTORY \ && mkdir -m 0777 -p $AGENT_TOOLSDIRECTORY \
&& chown 1000:1000 $AGENT_TOOLSDIRECTORY \ && chown -R 1001:1000 $AGENT_TOOLSDIRECTORY \
&& chmod 0777 $AGENT_TOOLSDIRECTORY \ && mkdir -m 0777 -p /github \
&& mkdir -p /github \ && chown -R 1001:1000 /github \
&& chown 1000:1000 /github \ && printf "\n\n\t🐋 Installing packages 🐋\t\n\n" \
&& chmod 0777 /github \
&& printf "\n\n\t🐋\t Installing packages \t🐋\t\n\n" \
&& apt-get -yq update \ && apt-get -yq update \
&& apt-get -yq install --no-install-recommends ssh lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https libyaml-0-2 zstd unzip xz-utils "$(apt-cache search libicu | grep -E 'libicu[[:digit:]]+ -' | cut -d \" \" -f 1)" \ && apt-get -yq install --no-install-recommends ssh lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https libyaml-0-2 zstd unzip xz-utils \
&& ln -s $(which python3) /usr/local/bin/python \ && ln -s $(which python3) /usr/local/bin/python \
&& [[ "${TAG}" == "16.04" ]] && printf 'git-lfs not available for Xenial' || apt-get -yq install --no-install-recommends git-lfs \ && [[ "${FROM_TAG}" == "16.04" ]] && printf 'git-lfs not available for Xenial' || apt-get -yq install --no-install-recommends git-lfs \
&& printf "\n\n\t🐋\t Updated apt lists and upgraded packages \t🐋\t\n\n" \ && printf "\n\n\t🐋 Updated apt lists and upgraded packages 🐋\t\n\n" \
&& printf "\n\n\t🐋\t Creating ~/.ssh and adding 'github.com' \t🐋\t\n\n" \ && printf "\n\n\t🐋 Creating ~/.ssh and adding 'github.com' 🐋\t\n\n" \
&& mkdir -p ~/.ssh \ && mkdir -m 0700 -p ~/.ssh \
&& chmod 700 ~/.ssh \
&& ssh-keyscan github.com | tee ~/.ssh/known_hosts \ && ssh-keyscan github.com | tee ~/.ssh/known_hosts \
&& printf "\n\n\t🐋\t Installed base utils\nInstalling docker \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installed base utils 🐋\t\n\n" \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ && printf "\n\n\t🐋 Installing docker cli 🐋\t\n\n" \
&& add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ && curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - \
&& sudo apt-add-repository https://packages.microsoft.com/ubuntu/${FROM_TAG}/prod \
&& apt-get -yq update \ && apt-get -yq update \
&& apt-get -yq install --no-install-recommends docker-ce-cli \ && apt-get -yq install --no-install-recommends moby-cli moby-buildx \
&& printf "\n\n\t🐋\t Installed $(docker -v)\n \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installed moby-cli 🐋\t\n\n" \
&& printf "\n\n\t🐋\t Installing Node.JS \t🐋\t\n\n" \ && docker version \
&& curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ && printf "\n\n\t🐋 Installed moby-buildx 🐋\t\n\n" \
&& DISTRO="$(lsb_release -s -c)" \ && docker buildx version \
&& echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list \ && printf "\n\n\t🐋 Installing Node.JS 🐋\t\n\n" \
&& echo "deb-src https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list \ && ver=$(curl https://nodejs.org/download/release/index.json | jq "[.[] | select(.version|test(\"^v${NODE_VERSION}\"))][0].version" -r) \
&& apt-get -yq update \ && node_path=$AGENT_TOOLSDIRECTORY/node/$(echo $ver | sed 's/v//g')/x64 \
&& apt-get -yq install --no-install-recommends nodejs="${NODE_VERSION}*" \ && mkdir -v -m 0777 -p $node_path \
&& printf "\n\n\t🐋\t Installed Node.JS $(node -v) \t🐋\t\n\n" \ && curl "https://nodejs.org/download/release/latest-v${NODE_VERSION}.x/node-${ver}-linux-x64.tar.xz" | tar -Jxf - --strip-components=1 -C $node_path \
&& dpkg-query -f '${binary:Package}\n' -W \ && sed "s|PATH=|PATH=${node_path}/bin:|g" -i /etc/environment \
&& printf "\n\n\t🐋\t Cleaning image \t🐋\t\n\n" \ && export PATH="${node_path}/bin:$PATH" \
&& printf "\n\n\t🐋 Installed Node.JS $(node -v) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Installed NPM $(npm -v) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Cleaning image 🐋\t\n\n" \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' \ && rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' \
&& printf "\n\n\t🐋\t Cleaned up image \t🐋\t\n\n" && printf "\n\n\t🐋 Cleaned up image 🐋\t\n\n"
ARG BUILD_TAG_VERSION="dev" ARG BUILD_TAG_VERSION="dev"
ARG BUILD_TAG="act" ARG BUILD_TAG="act"
@@ -74,10 +78,10 @@ ARG BUILD_REF="master"
LABEL org.opencontainers.image.vendor="catthehacker" LABEL org.opencontainers.image.vendor="catthehacker"
LABEL org.opencontainers.image.authors="me@hackerc.at" LABEL org.opencontainers.image.authors="me@hackerc.at"
LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${IMAGE}/${BUILD_TAG}/" LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${DISTRO}/${BUILD_TAG}/"
LABEL org.opencontainers.image.source="https://github.com/catthehacker/docker_images" LABEL org.opencontainers.image.source="https://github.com/catthehacker/docker_images"
LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION} LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION}
LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}-${TARGETVARIANT} LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}
LABEL org.opencontainers.image.revision=${BUILD_REF} LABEL org.opencontainers.image.revision=${BUILD_REF}
USER root USER root
+21 -12
View File
@@ -1,32 +1,41 @@
ARG IMAGE=ghcr.io/catthehacker/ubuntu ARG FROM_IMAGE=ghcr.io/catthehacker/ubuntu
ARG TAG=act-latest ARG FROM_TAG=act-latest
FROM ${IMAGE}:${TAG} FROM ${FROM_IMAGE}:${FROM_TAG}
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT ARG TARGETVARIANT
SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ] SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ]
RUN set -Eeuxo pipefail \ RUN set -Eeuxo pipefail \
&& printf "\n\n\t🐋\t Installing JS tools \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installing JS tools 🐋\t\n\n" \
&& printf "\n\n\t🐋\t Installed NPM $(npm -v) \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installed NPM $(npm -v) 🐋\t\n\n" \
&& npm install -g npm \ && npm install -g npm \
&& npm install -g pnpm \ && npm install -g pnpm \
&& npm install -g yarn \ && npm install -g yarn \
&& printf "\n\n\t🐋\t Installed NPM $(npm -v) \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installed NPM $(npm -v) 🐋\t\n\n" \
&& printf "\n\n\t🐋\t Installed PNPM $(pnpm -v) \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installed PNPM $(pnpm -v) 🐋\t\n\n" \
&& printf "\n\n\t🐋\t Installed YARN $(yarn -v) \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installed YARN $(yarn -v) 🐋\t\n\n" \
&& npm install -g grunt gulp n parcel-bundler typescript newman vercel webpack webpack-cli lerna \ && npm install -g grunt gulp n parcel-bundler typescript newman vercel webpack webpack-cli lerna \
&& npm install -g --unsafe-perm netlify-cli \ && npm install -g --unsafe-perm netlify-cli \
&& printf "\n\n\t🐋\t Cleaning image \t🐋\t\n\n" \ && printf "\n\n\t🐋 Installing NVM tools 🐋\t\n\n" \
&& VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name') \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash \
&& export NVM_DIR=$HOME/.nvm \
&& echo 'NVM_DIR=$HOME/.nvm' | tee -a /etc/environment \
&& echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& printf "\n\n\t🐋 Installed NVM $(nvm --version) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Cleaning image 🐋\t\n\n" \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' \ && rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' \
&& printf "\n\n\t🐋\t Cleaned up image \t🐋\t\n\n" && printf "\n\n\t🐋 Cleaned up image 🐋\t\n\n"
ARG BUILD_TAG_VERSION="dev" ARG BUILD_TAG_VERSION="dev"
ARG BUILD_TAG="rust" ARG BUILD_TAG="js"
ARG BUILD_REF="master" ARG BUILD_REF="master"
LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${ImageOS}/${BUILD_TAG}/" LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${ImageOS}/${BUILD_TAG}/"
LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION} LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION}
LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}-${TARGETVARIANT} LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}
LABEL org.opencontainers.image.revision=${BUILD_REF} LABEL org.opencontainers.image.revision=${BUILD_REF}
+20 -14
View File
@@ -1,13 +1,13 @@
ARG IMAGE=ghcr.io/catthehacker/ubuntu ARG FROM_IMAGE=ghcr.io/catthehacker/ubuntu
ARG TAG=act-latest ARG FROM_TAG=act-latest
FROM ${IMAGE}:${TAG} FROM ${FROM_IMAGE}:${FROM_TAG}
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT ARG TARGETVARIANT
# > ARGs before FROM are not accessible # > ARGs before FROM are not accessible
ARG IMAGE=catthehacker/ubuntu ARG FROM_IMAGE=catthehacker/ubuntu
ARG TAG=act-latest ARG FROM_TAG=act-latest
# > non-root user # > non-root user
ARG RUNNER=runner ARG RUNNER=runner
@@ -16,22 +16,28 @@ SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ]
# > Create non-root user # > Create non-root user
RUN set -Eeuxo pipefail \ RUN set -Eeuxo pipefail \
&& printf "\n\n\t🐋\t Creating non-root user \t🐋\t\n\n" \ && printf "\n\n\t🐋 Creating runner users 🐋\t\n\n" \
&& groupadd -g 1000 ${RUNNER} \ && groupadd -g 1001 ${RUNNER} \
&& useradd -u 1000 -g ${RUNNER} -G sudo -m -s /bin/bash ${RUNNER} \ && groupadd -g 1000 ${RUNNER}admin \
&& useradd -u 1001 -g ${RUNNER} -G sudo -m -s /bin/bash ${RUNNER} \
&& useradd -u 1000 -g ${RUNNER}admin -G sudo -m -s /bin/bash ${RUNNER}admin \
&& echo "${RUNNER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ && echo "${RUNNER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& printf "\n\n\t🐋\t Runner user: $(su - ${RUNNER} -c id) \t🐋\t\n\n" \ && echo "${RUNNER}admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& printf "\n\n\t🐋\t Created non-root user $(grep ${RUNNER} /etc/passwd) \t🐋\t\n\n" \ && printf "\n\n\t🐋 Runner user: $(su - ${RUNNER} -c id) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Runner admin: $(su - ${RUNNER}admin -c id) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Created non-root user $(grep ${RUNNER} /etc/passwd) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Created non-root admin $(grep ${RUNNER}admin /etc/passwd) 🐋\t\n\n" \
&& sed -i /etc/environment -e "s/USER=root/USER=${RUNNER}/g" \ && sed -i /etc/environment -e "s/USER=root/USER=${RUNNER}/g" \
&& echo "RUNNER_TEMP=/home/${RUNNER}/work/_temp" | tee -a /etc/environment \ && echo "RUNNER_TEMP=/home/${RUNNER}/work/_temp" | tee -a /etc/environment \
&& mkdir -p "/home/${RUNNER}/work/_temp" \ && mkdir -p "/home/${RUNNER}/work/_temp" \
&& chown -R ${RUNNER}:${RUNNER} "/home/${RUNNER}/work" \ && chown -R ${RUNNER}:${RUNNER} "/home/${RUNNER}/work" \
&& mkdir -p "/home/${RUNNER}/.ssh" \ && mkdir -m 0700 -p "/home/${RUNNER}/.ssh" \
&& chmod 700 "/home/${RUNNER}/.ssh" \
&& ssh-keyscan github.com | tee "/home/${RUNNER}/.ssh/known_hosts" \ && ssh-keyscan github.com | tee "/home/${RUNNER}/.ssh/known_hosts" \
&& chmod 644 "/home/${RUNNER}/.ssh/known_hosts" \ && chmod 644 "/home/${RUNNER}/.ssh/known_hosts" \
&& chown -R ${RUNNER}:${RUNNER} "/home/${RUNNER}/.ssh" \ && chown -R ${RUNNER}:${RUNNER} "/home/${RUNNER}/.ssh" \
&& printf "\n\n\t🐋\t Finished building \t🐋\t\n\n" && . /etc/environment \
&& chown -R ${RUNNER}:${RUNNER}admin $AGENT_TOOLSDIRECTORY \
&& printf "\n\n\t🐋 Finished building 🐋\t\n\n"
ARG BUILD_TAG_VERSION="dev" ARG BUILD_TAG_VERSION="dev"
ARG BUILD_TAG="runner" ARG BUILD_TAG="runner"
@@ -39,7 +45,7 @@ ARG BUILD_REF="master"
LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${ImageOS}/${BUILD_TAG}/" LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${ImageOS}/${BUILD_TAG}/"
LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION} LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION}
LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}-${TARGETVARIANT} LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}
LABEL org.opencontainers.image.revision=${BUILD_REF} LABEL org.opencontainers.image.revision=${BUILD_REF}
USER ${RUNNER} USER ${RUNNER}
+19 -10
View File
@@ -1,38 +1,47 @@
ARG IMAGE=ghcr.io/catthehacker/ubuntu ARG FROM_IMAGE=ghcr.io/catthehacker/ubuntu
ARG TAG=act-latest ARG FROM_TAG=act-latest
FROM ${IMAGE}:${TAG} FROM ${FROM_IMAGE}:${FROM_TAG}
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT ARG TARGETVARIANT
ARG DISTRO=ubuntu
ARG RUSTUP_HOME=/usr/share/rust/.rustup ARG RUSTUP_HOME=/usr/share/rust/.rustup
ARG CARGO_HOME=/usr/share/rust/.cargo ARG CARGO_HOME=/usr/share/rust/.cargo
SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ] SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ]
RUN set -Eeuxo pipefail \ RUN set -Eeuxo pipefail \
&& printf "Installing dependencies\n" \ && printf "\n\n\t🐋 Installing dependencies 🐋\t\n\n" \
&& apt-get -yq update \ && apt-get -yq update \
&& apt-get -yq install build-essential llvm \ && apt-get -yq install build-essential llvm \
&& printf "Installing Rust\n" \ && printf "\n\n\t🐋 Installing Rust 🐋\t\n\n" \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal \ && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal \
&& source ${CARGO_HOME}/env \ && source ${CARGO_HOME}/env \
&& rustup component add rustfmt clippy \ && rustup component add rustfmt clippy \
&& cargo install --locked bindgen cbindgen cargo-audit cargo-outdated \ && cargo install --locked bindgen cbindgen cargo-audit cargo-outdated \
&& chmod -R 777 $(dirname ${RUSTUP_HOME}) \ && chmod -R 777 $(dirname ${RUSTUP_HOME}) \
&& rm -rf ${CARGO_HOME}/registry/* \ && rm -rf ${CARGO_HOME}/registry/* \
&& sed "s|PATH=\"|PATH=\"${CARGO_HOME}/bin:|g" -i /etc/environment \ && sed "s|PATH=|PATH=${CARGO_HOME}/bin:|g" -i /etc/environment \
&& sed 's|"||g' -i /etc/environment \
&& cd /root \ && cd /root \
&& ln -sf ${CARGO_HOME} .cargo \ && ln -sf ${CARGO_HOME} .cargo \
&& ln -sf ${RUSTUP_HOME} .rustup \ && ln -sf ${RUSTUP_HOME} .rustup \
&& echo "RUSTUP_HOME=${RUSTUP_HOME}" | tee -a /etc/environment \ && echo "RUSTUP_HOME=${RUSTUP_HOME}" | tee -a /etc/environment \
&& echo "CARGO_HOME=${CARGO_HOME}" | tee -a /etc/environment && echo "CARGO_HOME=${CARGO_HOME}" | tee -a /etc/environment \
&& printf "\n\n\t🐋 Installed RUSTUP $(rustup -V) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Installed CARGO $(cargo -V) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Installed RUSTC $(rustc -V) 🐋\t\n\n" \
&& printf "\n\n\t🐋 Cleaning image 🐋\t\n\n" \
&& apt-get clean \
&& rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' \
&& printf "\n\n\t🐋 Cleaned up image 🐋\t\n\n"
ARG BUILD_TAG_VERSION="dev" ARG BUILD_TAG_VERSION="dev"
ARG BUILD_TAG="rust" ARG BUILD_TAG="rust"
ARG BUILD_REF="master" ARG BUILD_REF="master"
LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${ImageOS}/${BUILD_TAG}/" LABEL org.opencontainers.image.url="https://github.com/catthehacker/docker_images/tree/${BUILD_REF}/linux/${DISTRO}/${BUILD_TAG}/"
LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION} LABEL org.opencontainers.image.version=${BUILD_TAG_VERSION}
LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}-${TARGETVARIANT} LABEL org.opencontainers.image.title=${BUILD_TAG}-${TARGETARCH}
LABEL org.opencontainers.image.revision=${BUILD_REF} LABEL org.opencontainers.image.revision=${BUILD_REF}