-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (68 loc) · 2.03 KB
/
Copy pathdocker.yml
File metadata and controls
71 lines (68 loc) · 2.03 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
name: Docker image
on:
push:
branches:
- main
- feat-*
tags:
- v*
jobs:
build-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- name: "JVM"
dockerfile: src/main/docker/Dockerfile.jvm
image: ghcr.io/${{ github.repository_owner }}/subscription
- name: "Native"
dockerfile: src/main/docker/Dockerfile.multistage
image: ghcr.io/${{ github.repository_owner }}/subscription-native
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-${{ matrix.name }}"
cancel-in-progress: true
name: Docker image ${{ matrix.name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- shell: sh
run: mvn -B package -DskipTests -ntp
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{matrix.image}}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,format=long
type=raw,latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{matrix.image}}:latest
cache-to: type=inline