-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (70 loc) · 2.29 KB
/
Copy pathdocker-deploy.yml
File metadata and controls
77 lines (70 loc) · 2.29 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
permissions:
contents: read
name: Docker Deploy
on:
push:
tags: [v*]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# Run the CI workflow checks before building the Docker image.
# This prevents deploying a container that hasn't passed tests.
ci:
uses: ./.github/workflows/CI.yml
secrets:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
MERGIFY_TOKEN: ${{ secrets.MERGIFY_TOKEN }}
build:
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6.0.3
- uses: jdx/mise-action@v4.0.1
with:
install: true
cache: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: just install
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with: { platforms: "amd64,arm64" }
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4.1.0
- name: Log into the Container registry
uses: docker/login-action@v4.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v6.1.0
with: { images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" }
- name: Build image for vulnerability scanning (amd64 only)
uses: docker/build-push-action@v7.2.0
with:
context: .
platforms: linux/amd64
pull: true
push: false
load: true
tags: ${{ steps.meta.outputs.tags }}
- name: Scan container image for vulnerabilities
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
format: "table"
exit-code: "1"
severity: "CRITICAL,HIGH"
- name: Build and push the Docker image (multi-platform)
uses: docker/build-push-action@v7.2.0
with:
context: .
platforms: linux/amd64,linux/arm64
pull: true
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}