Skip to content

Revert "Try using ghcr.io for base images" #134

Revert "Try using ghcr.io for base images"

Revert "Try using ghcr.io for base images" #134

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: ubuntu-latest
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' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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}}
- uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: containers/slic
file: containers/slic/Dockerfile
push: true
tags: |
${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.php_version }}
cache-to: type=gha,mode=max,scope=${{ matrix.php_version }}
build-args: |
PHP_VERSION=${{ matrix.php_version }}
NODE_VERSION=18.13.0
NVM_VERSION=v0.39.7
platforms: linux/amd64,linux/arm64