Skip to content

Build Docker Image

Build Docker Image #4

Workflow file for this run

name: "Build Docker Image"
on:
workflow_dispatch:
inputs:
version:
default: ""
required: true
type: string
docker_target:
default: production
required: false
type: string
platforms:
default: linux/amd64
required: false
type: string
dev:
default: false
required: false
type: boolean
workflow_call:
inputs:
version:
default: ""
required: true
type: string
docker_target:
default: production
required: false
type: string
platforms:
default: linux/amd64
required: false
type: string
dev:
default: false
required: false
type: boolean
secrets:
CR_PAT:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.CR_PAT }}
- name: Build and push API
if: ${{ inputs.dev }}
uses: docker/build-push-action@v5
with:
file: docker/php/Dockerfile-dev
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.IMAGE }}:dev
build-args: |
WWWGROUP=1000
WWWUSER=1000
- name: Build and push API
if: ${{ !inputs.dev }}
uses: docker/build-push-action@v5
with:
file: docker/php/Dockerfile
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
target: ${{ inputs.docker_target }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.IMAGE }}:${{ inputs.version }}