Skip to content

Debug Push Image

Debug Push Image #85

Workflow file for this run

name: Docker
on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ '*.*.*' ]
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
push:
description: 'Push Image (true or false)'
type: choice
options:
- "true"
- "false"
required: true
jobs:
Build:
runs-on: 'ubuntu-latest'
strategy:
matrix:
php-version:
- "8.5"
- "8.4"
- "8.3"
- "8.2"
steps:
- name: Get current date
run: |
echo "YEAR=$(date +'%Y')" >> $GITHUB_ENV
echo "MONTH=$(date +'%m')" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Install requirements
run: pip install -r requirements.txt
# - name: Set up Docker
# uses: docker/setup-docker-action@v4
# with:
# daemon-config: |
# {
# "debug": true,
# "features": {
# "containerd-snapshotter": true
# }
# }
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate Dockerfiles
run: python3 ./build.py ${{ matrix.php-version }} --build-base --build-cli --build-fpm --build-fpm-apache --build-fpm-nginx --build-nginx
- name: Build Docker image base
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-php-${{ matrix.php-version }}-base
platforms: linux/amd64,linux/arm64
push: false
tags: |
byjg/php:${{ matrix.php-version }}-base,
byjg/php:${{ matrix.php-version }}-base-${{ env.YEAR }}.${{ env.MONTH }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build Docker image cli
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-php-${{ matrix.php-version }}-cli
platforms: linux/amd64,linux/arm64
push: false
tags: |
byjg/php:${{ matrix.php-version }}-cli,
byjg/php:${{ matrix.php-version }}-cli-${{ env.YEAR }}.${{ env.MONTH }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build Docker image fpm
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-php-${{ matrix.php-version }}-fpm
platforms: linux/amd64,linux/arm64
push: false
tags: |
byjg/php:${{ matrix.php-version }}-fpm,
byjg/php:${{ matrix.php-version }}-fpm-${{ env.YEAR }}.${{ env.MONTH }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build Docker image fpm-apache
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-php-${{ matrix.php-version }}-fpm-apache
platforms: linux/amd64,linux/arm64
push: false
tags: |
byjg/php:${{ matrix.php-version }}-fpm-apache,
byjg/php:${{ matrix.php-version }}-fpm-apache-${{ env.YEAR }}.${{ env.MONTH }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build Docker image fpm-nginx
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-php-${{ matrix.php-version }}-fpm-nginx
platforms: linux/amd64,linux/arm64
push: false
tags: |
byjg/php:${{ matrix.php-version }}-fpm-nginx,
byjg/php:${{ matrix.php-version }}-fpm-nginx-${{ env.YEAR }}.${{ env.MONTH }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build Docker image nginx
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-php-${{ matrix.php-version }}-nginx
platforms: linux/amd64,linux/arm64
push: false
tags: |
byjg/php:${{ matrix.php-version }}-nginx,
byjg/php:${{ matrix.php-version }}-nginx-${{ env.YEAR }}.${{ env.MONTH }}
labels: ${{ steps.meta.outputs.labels }}
- name: Push all built images
if: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }}
run: |
docker images
docker push byjg/php:${{ matrix.php-version }}-base
docker push byjg/php:${{ matrix.php-version }}-base-${{ env.YEAR }}.${{ env.MONTH }}
docker push byjg/php:${{ matrix.php-version }}-cli
docker push byjg/php:${{ matrix.php-version }}-cli-${{ env.YEAR }}.${{ env.MONTH }}
docker push byjg/php:${{ matrix.php-version }}-fpm
docker push byjg/php:${{ matrix.php-version }}-fpm-${{ env.YEAR }}.${{ env.MONTH }}
docker push byjg/php:${{ matrix.php-version }}-fpm-apache
docker push byjg/php:${{ matrix.php-version }}-fpm-apache-${{ env.YEAR }}.${{ env.MONTH }}
docker push byjg/php:${{ matrix.php-version }}-fpm-nginx
docker push byjg/php:${{ matrix.php-version }}-fpm-nginx-${{ env.YEAR }}.${{ env.MONTH }}
docker push byjg/php:${{ matrix.php-version }}-nginx
docker push byjg/php:${{ matrix.php-version }}-nginx-${{ env.YEAR }}.${{ env.MONTH }}
Documentation:
if: github.ref == 'refs/heads/master'
needs: Build
uses: byjg/byjg.github.io/.github/workflows/add-doc.yaml@master
with:
folder: devops
project: ${{ github.event.repository.name }}
secrets: inherit