Skip to content

chore(deps): update ghcr.io/linuxserver/baseimage-kasmvnc:alpine318 docker digest to eb37f58 #280

chore(deps): update ghcr.io/linuxserver/baseimage-kasmvnc:alpine318 docker digest to eb37f58

chore(deps): update ghcr.io/linuxserver/baseimage-kasmvnc:alpine318 docker digest to eb37f58 #280

name: "Containers: Test-and-Build"
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "apps/**"
- "dev/**"
- "base/**"
- ".github/workflows/containers.build.yaml"
pull_request:
paths:
- "apps/**"
- "dev/**"
- "base/**"
- ".github/workflows/containers.build.yaml"
# Detect which folders in project-root (which contain the containers) contain changes
jobs:
changes:
name: Get changes
runs-on: ubuntu-latest
outputs:
matrix: '{"container": ${{ env.containers }} }'
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: json
filters: |
changed:
- 'apps/**'
- 'dev/**'
- 'base/**'
- run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json
- id: reduce
run: |
CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[/]?)[^/]+/)(?<second_directory>(?<root2>[/]?)[^/]+)(?<extra_paths>.+))"; "\(.second_directory)") | unique' changes.json)
echo "containers<<EOF" >> $GITHUB_ENV
echo "${CONTAINERS}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
hadolint:
name: Run hadolint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: hadolint
uses: reviewdog/action-hadolint@2d90b15b2b969e507fc2a31af6e29ca19a0f9516 # v1.45.0
if: github.event_name == 'pull_request'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
filter_mode: diff_context
fail_on_error: true
build:
permissions:
actions: read # for detecting the Github Actions environment.
packages: write # for uploading attestations.
name: Build
runs-on: ubuntu-latest
needs:
- hadolint
- changes
strategy:
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
fail-fast: false
if: "!contains(github.event.head_commit.message, '[ci-skip]') && needs.changes.outputs.matrix != '' && toJson(fromJson(needs.changes.outputs.matrix)) != '[]'"
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# Define if tests and push should be run against which versions/platforms
- name: Prepare
id: prep
run: |
if test -f "./apps/${{ matrix.container }}/Dockerfile"; then
CATEGORY="apps"
VERSION=$(cat ./${CATEGORY}/${{ matrix.container }}/VERSION || echo "undef")
PLATFORM=$(cat ./${CATEGORY}/${{ matrix.container }}/PLATFORM || echo "linux/amd64")
fi
echo "category=${CATEGORY}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "platform=${PLATFORM}" >> $GITHUB_OUTPUT
if test -f "./${CATEGORY}/${{ matrix.container }}/goss.yaml"; then
echo 'goss=true' >> $GITHUB_OUTPUT
else
echo 'goss=false' >> $GITHUB_OUTPUT
fi
if [ "${{github.event_name}}" == "pull_request" ]; then
echo 'push=false' >> $GITHUB_OUTPUT
echo 'cache_from="type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:buildcache"' >> $GITHUB_OUTPUT || echo 'cache_from=""' >> $GITHUB_OUTPUT
echo 'cache_to=""' >> $GITHUB_OUTPUT
else
echo 'push=true' >> $GITHUB_OUTPUT
echo 'cache_from="type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:buildcache"' >> $GITHUB_OUTPUT
echo 'cache_to="type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:buildcache,mode=max"' >> $GITHUB_OUTPUT
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
- name: Log into registry GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
with:
install: true
version: latest
driver-opts: image=moby/buildkit:latest
# Push if not a PR, otherwise just test the build process for all requested platforms
- name: Build and Push
id: push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
with:
build-args: |
VERSION=${{ steps.prep.outputs.version }}
CONTAINER_NAME=${{ matrix.container }}
CONTAINER_VER=${{ steps.prep.outputs.version }}
context: .
platforms: ${{ steps.prep.outputs.platform }}
file: ./${{ steps.prep.outputs.category }}/${{ matrix.container }}/Dockerfile
push: ${{ steps.prep.outputs.push }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: ${{ steps.prep.outputs.cache_from }}
cache-to: ${{ steps.prep.outputs.cache_to }}
tags: ${{ steps.meta.outputs.tags }}
container-build-complete:
needs: [build]
name: Container Build Completed
runs-on: ubuntu-latest
steps:
- name: complete message
run: echo "Container Build and Tests Completed Successfully"
# NOTE
# many of this code was copied from the great workflow of truechats/containers
# https://github.com/truecharts/containers/blob/master/.github/workflows/containers.build.yaml