-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.44 KB
/
docker.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
name: DOCKER
on:
push:
# Trigger this workflow on changes to `main`
branches: [ main ]
# Trigger this workflow if a semver tag is pushed
tags: [ 'v*.*.*' ]
env:
# Our main, default container registry
GHC_REGISTRY: ghcr.io
# github.repository will be <account>/<repo>, for example, DEFRA/sroc-charging-module-api-tests
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Login against a GitHub Container registry
# https://github.com/docker/login-action
- name: Log into GH Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHC_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHC_REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
target: production
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}