Skip to content

GHA: Docker build: Use GITHUB token to log in to the container registry #1262

GHA: Docker build: Use GITHUB token to log in to the container registry

GHA: Docker build: Use GITHUB token to log in to the container registry #1262

Workflow file for this run

name: Build docker container for the SP Dashboard
on:
pull_request:
release:
types: [ published ]
push:
branches: [ develop ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
permissions:
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set docker metadata for php fpm container
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/surfnet/sp-dashboard/spdashboard_php-fpm
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build the php-fpm container and push to GitHub Packages
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
target: phpfpm-build
- name: Build the Apache container and push to GitHub Packages
uses: docker/build-push-action@v1
with:
dockerfile: docker/Dockerfile
registry: ghcr.io
repository: surfnet/sp-dashboard/spdashboard_web
tag_with_ref: true
push: true
target: httpd-build