Skip to content

chore: use non-root user for PHP 32bits image #553

chore: use non-root user for PHP 32bits image

chore: use non-root user for PHP 32bits image #553

Workflow file for this run

name: Docker Image Build
on:
push:
branches: [ master ]
paths:
- '*/Dockerfile'
- '.github/workflows/build-test.yml'
pull_request:
branches: [ master ]
paths:
- '*/Dockerfile'
- '.github/workflows/build-test.yml'
jobs:
files:
runs-on: ubuntu-latest-low
outputs:
matrix: ${{ steps.dockerfile.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
fetch-depth: 0
- name: Get changed files
id: files
uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42 # v1
with:
format: json
- name: Extract Dockerfile files
id: dockerfile
run: |
FILES=$( echo '${{ steps.files.outputs.added_modified }}' | jq -c 'map(select(. | endswith("Dockerfile")))' )
echo "matrix=$FILES" >> "$GITHUB_OUTPUT"
build:
runs-on: [ubuntu-latest, self-hosted]
needs: files
strategy:
fail-fast: false
matrix:
dockerfile: ${{ fromJSON(needs.files.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
# https://github.com/tonistiigi/binfmt/issues/240
# https://github.com/docker/buildx/issues/1170
image: tonistiigi/binfmt:qemu-v7.0.0-28
cache-image: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build Docker image ${{ matrix.dockerfile }}
run: |
IMAGE=$(dirname ${{ matrix.dockerfile }})
cd "$(dirname ${{ matrix.dockerfile }})"
case "$IMAGE" in
android*)
PLATFORM="" ;;
client*)
PLATFORM="--platform linux/amd64" ;;
translations*)
PLATFORM="--platform linux/amd64" ;;
*32bit)
PLATFORM="--platform linux/386" ;;
*)
PLATFORM="--platform linux/amd64,linux/arm64" ;;
esac
docker buildx build $PLATFORM . --file Dockerfile