-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.63 KB
/
build-image.yaml
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: Build Docker Images for GHCR
on:
push:
branches:
- main
jobs:
build-image:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- Dockerfile: coffee-maker/Dockerfile
context: coffee-maker
tag: latest
name: "coffee-maker"
- Dockerfile: routes/Dockerfile
context: routes
tag: latest
name: "routes"
- Dockerfile: controller/Dockerfile
context: controller
tag: latest
name: "controller"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Checkout code
uses: actions/checkout@v4
- name: set repository name to lowercase
run: |
echo "reponame=${reponame,,}" >>${GITHUB_ENV}
env:
reponame: '${{ github.repository }}'
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }} # Use the new secret here
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/une-tasse-de.cafe/${{ env.reponame }}/${{ matrix.name }}:${{ matrix.tag }}
platforms: linux/amd64,linux/arm64