Use shorter image names, add Docker Hub, lower frequency of runs, run more in parallel
This commit is contained in:
@@ -2,7 +2,7 @@ name: Daily build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 0 */6 * * *
|
- cron: 0 0 * * *
|
||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -13,18 +13,21 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 12
|
||||||
matrix:
|
matrix:
|
||||||
DISTRIB_ID: [ubuntu]
|
DISTRIB_ID: [ubuntu]
|
||||||
DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04]
|
DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04]
|
||||||
IMAGE_TYPE: [nodejs, runner]
|
IMAGE_TYPE: [act, runner]
|
||||||
NODE_VERSION: ['12']
|
NODE_VERSION: ['12']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
@@ -32,11 +35,20 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: catthehacker
|
||||||
|
password: ${{ secrets.DCKR_TOKEN }}
|
||||||
|
|
||||||
- name: Check which version is currently `ubuntu-latest`
|
- name: Check which version is currently `ubuntu-latest`
|
||||||
id: ubuntu_latest
|
id: ubuntu_latest
|
||||||
if: ${{ matrix.DISTRIB_RELEASE == 'latest' }}
|
if: ${{ matrix.DISTRIB_RELEASE == 'latest' }}
|
||||||
run: echo "::set-output name=UBUNTU_LATEST::$(lsb_release -sr)"
|
run: echo "::set-output name=UBUNTU_LATEST::$(lsb_release -sr)"
|
||||||
- name: Build and push ${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} image
|
|
||||||
|
- name: Build and push ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
||||||
id: docker_build_version
|
id: docker_build_version
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
if: ${{ matrix.DISTRIB_RELEASE != 'latest' }}
|
if: ${{ matrix.DISTRIB_RELEASE != 'latest' }}
|
||||||
@@ -45,12 +57,15 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||||
file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile
|
file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ghcr.io/catthehacker/docker-images:${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
tags: |
|
||||||
|
ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
||||||
|
docker.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
||||||
build-args: |
|
build-args: |
|
||||||
DISTRIB_ID=${{ matrix.DISTRIB_ID }}
|
DISTRIB_ID=${{ matrix.DISTRIB_ID }}
|
||||||
DISTRIB_RELEASE=${{ matrix.DISTRIB_RELEASE }}
|
DISTRIB_RELEASE=${{ matrix.DISTRIB_RELEASE }}
|
||||||
NODE_VERSION=${{ matrix.NODE_VERSION }}
|
NODE_VERSION=${{ matrix.NODE_VERSION }}
|
||||||
- name: Build and push ${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-latest image
|
|
||||||
|
- name: Build and push ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
||||||
id: docker_build_latest
|
id: docker_build_latest
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
if: ${{ matrix.DISTRIB_RELEASE == 'latest' }}
|
if: ${{ matrix.DISTRIB_RELEASE == 'latest' }}
|
||||||
@@ -59,7 +74,9 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||||
file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile
|
file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ghcr.io/catthehacker/docker-images:${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-latest
|
tags: |
|
||||||
|
ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
||||||
|
docker.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
|
||||||
build-args: |
|
build-args: |
|
||||||
DISTRIB_ID=${{ matrix.DISTRIB_ID }}
|
DISTRIB_ID=${{ matrix.DISTRIB_ID }}
|
||||||
DISTRIB_RELEASE=${{ steps.ubuntu_latest.outputs.UBUNTU_LATEST }}
|
DISTRIB_RELEASE=${{ steps.ubuntu_latest.outputs.UBUNTU_LATEST }}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
- `\linux\ubuntu\runner\Dockerfile` - used as base image for [github.com/catthehacker/act](https://github.com/catthehacker/act)
|
- `\linux\ubuntu\runner\Dockerfile` - used as base image for [github.com/catthehacker/act](https://github.com/catthehacker/act)
|
||||||
- ghcr.io (GitHub Container Registry)
|
- ghcr.io (GitHub Container Registry)
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-16.04`
|
- `ghcr.io/catthehacker/ubuntu:runner-16.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-18.04`
|
- `ghcr.io/catthehacker/ubuntu:runner-18.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-20.04`
|
- `ghcr.io/catthehacker/ubuntu:runner-20.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-latest`
|
- `ghcr.io/catthehacker/ubuntu:runner-latest`
|
||||||
- `\linux\ubuntu\nodejs\Dockerfile` - proposal for [github.com/nektos/act](https://github.com/nektos/act) as base image before support for above image is implemented
|
- `\linux\ubuntu\act\Dockerfile` - proposal for [github.com/nektos/act](https://github.com/nektos/act) as base image before support for above image is implemented
|
||||||
- ghcr.io (GitHub Container Registry)
|
- ghcr.io (GitHub Container Registry)
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-16.04`
|
- `ghcr.io/catthehacker/ubuntu:act-16.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-18.04`
|
- `ghcr.io/catthehacker/ubuntu:act-18.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-20.04`
|
- `ghcr.io/catthehacker/ubuntu:act-20.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-latest`
|
- `ghcr.io/catthehacker/ubuntu:act-latest`
|
||||||
|
|||||||
@@ -1,68 +1,68 @@
|
|||||||
ARG DISTRIB_ID=ubuntu
|
ARG DISTRIB_ID=ubuntu
|
||||||
ARG DISTRIB_RELEASE=20.04
|
ARG DISTRIB_RELEASE=20.04
|
||||||
FROM ${DISTRIB_ID}:${DISTRIB_RELEASE}
|
FROM ${DISTRIB_ID}:${DISTRIB_RELEASE}
|
||||||
|
|
||||||
# > ARGs before FROM are not accessible
|
# > ARGs before FROM are not accessible
|
||||||
ARG DISTRIB_ID=ubuntu
|
ARG DISTRIB_ID=ubuntu
|
||||||
ARG DISTRIB_RELEASE=20.04
|
ARG DISTRIB_RELEASE=20.04
|
||||||
|
|
||||||
# > Node version
|
# > Node version
|
||||||
ARG NODE_VERSION=12
|
ARG NODE_VERSION=12
|
||||||
|
|
||||||
# > Force apt to not be interactive/not ask
|
# > Force apt to not be interactive/not ask
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-c" ]
|
||||||
|
|
||||||
# > setup environment required for GitHub Actions
|
# > setup environment required for GitHub Actions
|
||||||
RUN set -Eeuxo pipefail && \
|
RUN set -Eeuxo pipefail && \
|
||||||
printf "Build started" && \
|
printf "Build started" && \
|
||||||
ImageOS=${DISTRIB_ID}$(echo ${DISTRIB_RELEASE} | cut -d'.' -f 1) && \
|
ImageOS=${DISTRIB_ID}$(echo ${DISTRIB_RELEASE} | 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=${DISTRIB_RELEASE}" | tee -a /etc/environment && \
|
echo "LSB_RELEASE=${DISTRIB_RELEASE}" | 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 -p $AGENT_TOOLSDIRECTORY && \
|
||||||
chown 1000:1000 $AGENT_TOOLSDIRECTORY && \
|
chown 1000:1000 $AGENT_TOOLSDIRECTORY && \
|
||||||
chmod 0777 $AGENT_TOOLSDIRECTORY && \
|
chmod 0777 $AGENT_TOOLSDIRECTORY && \
|
||||||
mkdir -p /github && \
|
mkdir -p /github && \
|
||||||
chown 1000:1000 /github && \
|
chown 1000:1000 /github && \
|
||||||
chmod 0777 /github
|
chmod 0777 /github
|
||||||
|
|
||||||
# > Install deps
|
# > Install deps
|
||||||
RUN set -Eeuxo pipefail && \
|
RUN set -Eeuxo pipefail && \
|
||||||
apt -yq update && \
|
apt -yq update && \
|
||||||
printf "Updated apt lists and upgraded packages\n\n" && \
|
printf "Updated apt lists and upgraded packages\n\n" && \
|
||||||
apt -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 && \
|
apt -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 && \
|
||||||
printf "Installed base utils"
|
printf "Installed base utils"
|
||||||
|
|
||||||
# > Install Node.JS
|
# > Install Node.JS
|
||||||
RUN set -Eeuxo pipefail && \
|
RUN set -Eeuxo pipefail && \
|
||||||
printf "Installing Node.JS" && \
|
printf "Installing Node.JS" && \
|
||||||
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
|
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
|
||||||
DISTRO="$(lsb_release -s -c)" && \
|
DISTRO="$(lsb_release -s -c)" && \
|
||||||
echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||||
echo "deb-src https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
|
echo "deb-src https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
|
||||||
apt -yq update && \
|
apt -yq update && \
|
||||||
apt -yq install --no-install-recommends nodejs="${NODE_VERSION}*" && \
|
apt -yq install --no-install-recommends nodejs="${NODE_VERSION}*" && \
|
||||||
printf "Installed Node.JS $(node -v)"
|
printf "Installed Node.JS $(node -v)"
|
||||||
|
|
||||||
# > Clean up image
|
# > Clean up image
|
||||||
RUN set -Eeuxo pipefail && \
|
RUN set -Eeuxo pipefail && \
|
||||||
printf "Cleaning image" && \
|
printf "Cleaning image" && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
rm -rf /tmp/* && \
|
rm -rf /tmp/* && \
|
||||||
printf "Cleaned up image"
|
printf "Cleaned up image"
|
||||||
|
|
||||||
# > Home repository
|
# > Home repository
|
||||||
LABEL org.opencontainers.image.source="https://github.com/CatTheHacker/docker-images"
|
LABEL org.opencontainers.image.source="https://github.com/CatTheHacker/docker-images"
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "--login" ]
|
SHELL [ "/bin/bash", "--login" ]
|
||||||
|
|
||||||
# > Force bash with environment
|
# > Force bash with environment
|
||||||
ENTRYPOINT [ "/bin/bash", "--login" ]
|
ENTRYPOINT [ "/bin/bash", "--login" ]
|
||||||
Reference in New Issue
Block a user