-
Notifications
You must be signed in to change notification settings - Fork 42
70 lines (61 loc) · 2.16 KB
/
docker_deploy.yml
File metadata and controls
70 lines (61 loc) · 2.16 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
# -----------------------------------------------------------------------------
# Copyright Helio Chissini de Castro 2023.
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------
name: Docker Build
on:
workflow_dispatch:
pull_request:
paths:
- Dockerfile
- .github/workflows/docker_deploy.yml
push:
paths-ignore:
- '**.md'
tags:
- 'v*'
env:
REGISTRY: ghcr.io
jobs:
docker_push:
name: Build Docker Image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout main repository
uses: actions/checkout@v5
- name: Setup QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract components metadata
id: meta_base
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v51.0.0
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
labels: org.opencontainers.image.licenses=Apache-2.0
- name: Build Container
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
load: false
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta_base.outputs.tags }}
labels: ${{ steps.meta_base.outputs.labels }}
cache-from: type=gha,scope=tools_java
cache-to: type=gha,scope=tools_java,mode=max