-
Notifications
You must be signed in to change notification settings - Fork 127
58 lines (55 loc) · 1.8 KB
/
Copy path_docker-image.yml
File metadata and controls
58 lines (55 loc) · 1.8 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
name: Docker image
on:
workflow_call:
inputs:
image-suffix:
description: Image name under ghcr.io/<owner>/<repo>/ (e.g. service-alarm-server).
required: true
type: string
context:
description: Docker build context directory.
required: true
type: string
maven-args:
description: Maven goals/flags for the package step.
type: string
default: --update-snapshots package
permissions:
contents: read
packages: write
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- name: Set up Java
uses: ./.github/actions/setup-java
- name: Build with Maven
run: mvn --batch-mode $MAVEN_ARGS
env:
MAVEN_ARGS: ${{ inputs.maven-args }}
- name: Login to the registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract meta-data for Docker
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9
with:
images: ghcr.io/${{ github.repository }}/${{ inputs.image-suffix }}
- name: Set up Docker Build
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5
- name: Build and publish the Docker image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf
with:
context: ${{ inputs.context }}
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max