-
Notifications
You must be signed in to change notification settings - Fork 149
92 lines (83 loc) · 3.19 KB
/
docker-publish.yml
File metadata and controls
92 lines (83 loc) · 3.19 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Build & Publish Docker Images (Swarm)
# Builds evo-nexus-runtime and evo-nexus-dashboard images using the
# Swarm-specific Dockerfiles (Dockerfile.swarm and Dockerfile.swarm.dashboard)
# and pushes them to Docker Hub under the `evoapicloud` namespace. The
# upstream Dockerfile and Dockerfile.dashboard are intentionally NOT used
# here: they are for local `docker compose up`, while these variants carry
# the Swarm-specific bootstrap (entrypoint.sh, start-dashboard.sh, terminal-
# server native build, both CLIs on PATH).
#
# Triggers:
# * push to main -> builds + publishes :latest
# * push of a version tag -> builds + publishes :vX.Y.Z and :latest
# * manual dispatch -> builds without pushing (dry-run)
#
# Required repository secrets:
# * DOCKERHUB_USERNAME — Docker Hub account with push rights to evoapicloud
# * DOCKERHUB_TOKEN — access token (Settings → Security → New Access Token)
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
env:
REGISTRY: docker.io
NAMESPACE: evoapicloud
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
jobs:
build-and-push:
name: Build & push ${{ matrix.image }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- image: evo-nexus-runtime
dockerfile: Dockerfile.swarm
- image: evo-nexus-dashboard
dockerfile: Dockerfile.swarm.dashboard
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU (for arm64 emulation on amd64 runners)
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'workflow_dispatch'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.image }}
# Boa prática: publicar :latest junto com a tag versionada sempre
# que um release (tag v*) for empurrado. Push para a branch main
# sem tag também atualiza :latest.
flavor: |
latest=${{ github.ref_type == 'tag' || github.ref == 'refs/heads/main' }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-,format=short
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'workflow_dispatch' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,scope=${{ matrix.image }},mode=max