-
Notifications
You must be signed in to change notification settings - Fork 128
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@3d3c42e5aac5ba805825da76410c181273ba90b1
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@dbcb813823bdd20940b903addbd779551569679f
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract meta-data for Docker
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302
with:
images: ghcr.io/${{ github.repository }}/${{ inputs.image-suffix }}
- name: Set up Docker Build
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c
- name: Build and publish the Docker image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a
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