-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.15 KB
/
build.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
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
---
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
# cancel any previously-started, yet still active runs of this workflow on the same branch
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
packages: write
env:
FORCE_COLOR: 1
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: 📦 Checkout Repository
id: checkout
uses: actions/checkout@v4
- name: 🛠️ Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: 🛠️ Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: 🏷️ Login to GHCR
id: login_ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🔖 Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: ghcr.io/${{ github.repository }}/springboot-server
flavor: latest=auto
tags: |
type=raw,value=latest,enable={{is_default_branch}},priority=300
type=ref,event=tag,priority=200
- name: 🐳 Docker Build and Push
id: build_image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
file: ./Dockerfile
target: prod
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
provenance: true
sbom: true