diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index b035388..10b55d8 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -24,7 +24,6 @@ jobs: fail-fast: false # Don't cancel other jobs if one fails matrix: include: - - version: "8.1" - version: "8.2" - version: "8.3" - version: "8.4" @@ -87,6 +86,7 @@ jobs: context: ./src file: ./src/Dockerfile build-args: | + CLI_IMAGE=ghcr.io/${{ github.repository_owner }}/service-cli CLI_VERSION=php${{ matrix.version }} INSTALL_SQLITE=${{ matrix.version >= '8.3' }} platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/service-cli.yml b/.github/workflows/service-cli.yml new file mode 100644 index 0000000..e8fabde --- /dev/null +++ b/.github/workflows/service-cli.yml @@ -0,0 +1,83 @@ +--- +name: "build interim service-cli images" + +# Temporary: builds docksal/cli from the phase2/service-cli fork until +# https://github.com/docksal/service-cli/pull/350 is merged and released. + +on: + workflow_dispatch: + schedule: + - cron: '0 10 * * 0' # Every Sunday at 10AM + +permissions: + contents: read + packages: write + +env: + IMAGE: ghcr.io/${{ github.repository_owner }}/service-cli + SOURCE_REPO: phase2/service-cli + SOURCE_REF: phase2-interim + +jobs: + build: + name: "Build: ${{ matrix.version }}/${{ matrix.arch }}" + runs-on: ${{ matrix.runner }} + + strategy: + fail-fast: false + matrix: + version: ["8.2", "8.3", "8.4"] + arch: [amd64, arm64] + include: + - arch: amd64 + runner: ubuntu-24.04 + - arch: arm64 + runner: ubuntu-24.04-arm + + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + repository: ${{ env.SOURCE_REPO }} + ref: ${{ env.SOURCE_REF }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build + uses: docker/build-push-action@v7 + with: + context: ${{ matrix.version }} + file: ${{ matrix.version }}/Dockerfile + build-args: VERSION=${{ matrix.version }} + tags: ${{ env.IMAGE }}:php${{ matrix.version }}-${{ matrix.arch }} + push: true + pull: true + no-cache: true + + push: + name: "Push: ${{ matrix.version }}/multi" + runs-on: ubuntu-24.04 + needs: build + + strategy: + matrix: + version: ["8.2", "8.3", "8.4"] + + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push multi-arch image + run: | + docker buildx imagetools create -t "${IMAGE}:php${{ matrix.version }}" \ + "${IMAGE}:php${{ matrix.version }}-amd64" \ + "${IMAGE}:php${{ matrix.version }}-arm64" diff --git a/src/Dockerfile b/src/Dockerfile index b32f6ea..e59c3c5 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,7 +1,8 @@ +ARG CLI_IMAGE=docksal/cli ARG CLI_VERSION={{cli_version}} # Extend the Docksal CLI per https://docs.docksal.io/stack/extend-images/ -FROM docksal/cli:${CLI_VERSION} +FROM ${CLI_IMAGE}:${CLI_VERSION} # See https://github.com/hadolint/hadolint/wiki/DL4006 SHELL ["/bin/bash", "-o", "pipefail", "-c"]