-
Notifications
You must be signed in to change notification settings - Fork 167
41 lines (37 loc) · 1.16 KB
/
docker-image.yml
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
name: Build & publish event-streams-samples images
on:
push:
branches: ['master']
paths:
- 'kafka-java-console-sample/**'
env:
REGISTRY: ghcr.io
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- directory: kafka-java-console-sample
image: kafka-java-console-sample:latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build image
run: |
cd ${{ matrix.directory }}
docker build . --file Dockerfile --tag ${{ matrix.image }} --label "latest"
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/${{ matrix.image }}
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID=$IMAGE_ID
docker tag ${{ matrix.image }} $IMAGE_ID
docker push $IMAGE_ID