Repository navigation
53 lines (46 loc) · 1.6 KB
/
Copy pathservice.yaml
File metadata and controls
53 lines (46 loc) · 1.6 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
# In the directory /feautre, build the Dockerfile using docker-build-push action
# If it is a tag on main, the push the image, otherwise just build it without pushing.
# Build amd64 and arm64 images and push to GitHub Container Registry as a single multiarch image:
# only get active on the patch /service
name: feature (service)
on:
push:
branches:
- main
paths:
- 'service/**'
- '.github/workflows/service.yaml'
tags:
- '*.*.*'
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# We need to pass the tag or the short hash as build argument VERSOION to the Dockerfile
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./service
push: ${{ github.ref_type == 'tag' || github.ref == 'refs/heads/main' }}
tags: ghcr.io/${{ github.repository_owner }}/feature:latest,ghcr.io/${{ github.repository_owner }}/feature:${{ github.ref_name }}
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ github.ref_name }}