Skip to content

Merge pull request #1719 from keymanapp/chore/505-add-to-keyman-project #23

Merge pull request #1719 from keymanapp/chore/505-add-to-keyman-project

Merge pull request #1719 from keymanapp/chore/505-add-to-keyman-project #23

Workflow file for this run

name: Docker-build
on:
push:
branches: [ "master", "staging" ]
paths:
- Dockerfile
- composer.*
- resources/**
- .github/**
env:
REGISTRY: ghcr.io
IMAGE_NAME: keymanapp/help-keyman-com
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/[email protected]
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value={{branch}}
type=raw,value=latest
labels: |
org.opencontainers.image.description=PHP api runtime
# Run the local build.sh configure
- name: Configure site
id: configure-site
run: ./build.sh configure
# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max