Skip to content

fix: cleanup stack configuration loading #235

fix: cleanup stack configuration loading

fix: cleanup stack configuration loading #235

name: Publish slic-php docker image
on:
push:
branches:
- main
- '[0-9]+.[0-9]+.[0-9]+'
release:
types: [published]
jobs:
publish-slic-image:
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
strategy:
matrix:
# The php_version is the docker tag from https://hub.docker.com/_/php/tags
php_version: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
arch: [ 'amd64', 'arm64' ]
# Add runner and platform info for each architecture
include:
- arch: amd64
runner: ubuntu-latest
platform: linux/amd64
- arch: arm64
runner: ubuntu-24.04-arm
platform: linux/arm64
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-php${{ matrix.php_version }}
tags: |
type=edge,branch=main
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{raw}}
flavor: |
suffix=-${{ matrix.arch }},onlatest=true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: containers/slic
file: containers/slic/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Use the faster registry cache with platform-specific caching
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/cache/slic-php${{ matrix.php_version }}-${{ matrix.arch }}
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/cache/slic-php${{ matrix.php_version }}-${{ matrix.arch }},mode=max
build-args: |
PHP_VERSION=${{ matrix.php_version }}
NODE_VERSION=18.17.0
NVM_VERSION=v0.40.1
platforms: ${{ matrix.platform }}
create-slic-manifest:
needs: publish-slic-image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
php_version: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest
run: |
# Determine the tag based on the event type
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
TAG="edge"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
else
TAG="${GITHUB_REF#refs/heads/}"
fi
IMAGE_BASE="ghcr.io/${{ github.repository }}-php${{ matrix.php_version }}"
# Create multi-arch manifest
docker buildx imagetools create -t "${IMAGE_BASE}:${TAG}" \
"${IMAGE_BASE}:${TAG}-amd64" \
"${IMAGE_BASE}:${TAG}-arm64"