-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.49 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build default "Maintenance Page" container
on:
push:
branches: [ "1.x" ]
jobs:
build:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
CONTAINER_NAME: ${{ github.repository }}/nginx-maintenance-page
BASE_TAG: ${{ vars.NGINX_CONTAINER_TAG }}
BUILD_PLATFORMS: linux/amd64,linux/arm64
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Log into registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract container metadata
id: meta
uses: docker/metadata-action@v4
with:
images: "${{ env.REGISTRY }}/${{ env.CONTAINER_NAME }}"
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: maintenance-page/
file: ${{ steps.dockerfile.outputs.filename }}
build-args: |
BASE_TAG=${{ env.BASE_TAG }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.BUILD_PLATFORMS }}
# GitHub Actions Caches
# https://docs.docker.com/build/cache/backends/gha/#using-dockerbuild-push-action
cache-from: type=gha
cache-to: type=gha,mode=max