Skip to content

fix (CI): fixed testing step image loading #2

fix (CI): fixed testing step image loading

fix (CI): fixed testing step image loading #2

Workflow file for this run

name: Build, Test & Push images
on:
push:
tags:
- "*.*.*" # e.g., 1.0.0, 2.1.3
workflow_dispatch:
env:
IMAGE_NAME: ${{ vars.IMAGE_NAME }}
PLATFORMS: ${{ vars.PLATFORMS }}
TEST_PLATFORM: ${{ vars.TEST_PLATFORM }}
jobs:
build-test-push:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- variant: debian
dockerfile: ./debian.dockerfile
tag: debian
latest: true
- variant: alpine
dockerfile: ./alpine.dockerfile
tag: alpine
latest: false
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Determine tag name
id: vars
run: echo "VERSION_TAG=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
- name: Extract OCI metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ matrix.tag }}
type=raw,value=${{ matrix.tag }}-${{ steps.vars.outputs.VERSION_TAG }}
${{ matrix.latest && format('type=raw,value=latest') || '' }}
labels: |
org.opencontainers.image.title=VNC Browser (${{ matrix.tag }})
org.opencontainers.image.version=${{ steps.vars.outputs.VERSION_TAG }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
# Build only one architecture image for testing to being able to --load it
- name: Build ${{ matrix.variant }} image for test
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ env.TEST_PLATFORM }}
push: false
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test container startup
run: |
docker run -d --rm --name test-${{ matrix.tag }} \
-p 5900:5900 -p 6080:6080 \
-e VNC_PASSWORD=testpass \
${{ env.IMAGE_NAME }}:${{ matrix.tag }}
echo "Waiting for container to start..."
sleep 10
docker ps
curl -sSf http://localhost:6080 > /dev/null
echo "Test passed for ${{ matrix.tag }}"
# Build and push multi-arch images
- name: Push multi-arch ${{ matrix.variant }} image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max