Skip to content

reorganizing how build and push images using github workflow strategy… #30

reorganizing how build and push images using github workflow strategy…

reorganizing how build and push images using github workflow strategy… #30

Workflow file for this run

name: "Docker build and push"
on:
push:
branches: [ "master" ]
jobs:
build_push_images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
version: ["8.3-cli", "8.3-fpm", "8.4-cli", "8.4-fpm", "8.5-cli", "8.5-fpm" ]
environment: ["dev","prod"]
os: ["alpine"]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build image
run: |
docker build --no-cache --target ${{matrix.environment}} -t ${{ github.repository_owner }}/php:${{matrix.version}}-${{matrix.os}}-${{matrix.environment}} ./${{matrix.os}}
- name: push image
run: |
docker push ${{ github.repository_owner }}/\php:${{matrix.version}}-${{matrix.os}}-${{matrix.environment}}