Skip to content

Build Docker Image

Build Docker Image #7

Workflow file for this run

name: "Build Docker Image"
on:
workflow_dispatch:
inputs:
version:
default: ""
required: false
type: string
platforms:
default: linux/amd64
required: false
type: string
dev:
default: false
required: false
type: boolean
base:
default: false
required: false
type: boolean
image:
default: 'ghcr.io/malusevdevelopment/website'
required: false
type: string
nginx-image:
default: 'ghcr.io/malusevdevelopment/nginx'
required: false
type: string
valkey-image:
default: 'ghcr.io/malusevdevelopment/valkey'
required: false
type: string
workflow_call:
inputs:
version:
default: ""
required: false
type: string
platforms:
default: linux/amd64
required: false
type: string
dev:
default: false
required: false
type: boolean
base:
default: false
required: false
type: boolean
image:
default: 'ghcr.io/malusevdevelopment/website'
required: false
type: string
nginx-image:
default: 'ghcr.io/malusevdevelopment/nginx'
required: false
type: string
valkey-image:
default: 'ghcr.io/malusevdevelopment/valkey'
required: false
type: string
secrets:
CR_PAT:
required: true
REGISTRY:
required: true
REGISTRY_USERNAME:
required: true
jobs:
build:
runs-on: ubuntu-24.04
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 Base image
if: ${{ inputs.base }}
uses: docker/build-push-action@v5
with:
file: docker/php/Dockerfile
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: base
tags: ${{ inputs.image }}:base
build-args: |
WWWGROUP=1000
WWWUSER=1000
- name: Build Development image
if: ${{ inputs.dev }}
uses: docker/build-push-action@v5
with:
file: docker/php/Dockerfile
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ inputs.image }}:dev
build-args: |
BASE=${{ inputs.image }}:base
WWWGROUP=1000
WWWUSER=1000
- name: Build Nginx
if: ${{ inputs.version != '' }}
uses: docker/build-push-action@v5
with:
file: deploy/nginx/Dockerfile
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ inputs.nginx-image }}:${{ inputs.version }}
${{ inputs.nginx-image }}:latest
- name: Build Valkey
if: ${{ inputs.version != '' }}
uses: docker/build-push-action@v5
with:
file: deploy/valkey/Dockerfile
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ inputs.valkey-image }}:${{ inputs.version }}
${{ inputs.valkey-image }}:latest
- name: Build Production Image
if: ${{ inputs.version != '' }}
uses: docker/build-push-action@v5
with:
file: docker/php/Dockerfile
context: .
push: true
pull: true
platforms: ${{ inputs.platforms }}
target: production
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ inputs.image }}:${{ inputs.version }}
${{ inputs.image }}:latest
build-args: |
BASE=${{ inputs.image }}:base