-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.5 KB
/
docker_build.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
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
name: Docker build using matrix
on:
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
projects: [
"subscriptions_holder", "t_coubs_initiator", "coub_smart_searcher",
"kafka_message_producer", "kafka_message_consumer", "telegram_bot"
]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: tests
run: gradle ${{ matrix.projects }}:clean ${{ matrix.projects }}:test
build:
needs: [ test ]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
docker-file: [ "coub_smart_searcher",
"kafka_message_consumer",
"kafka_message_producer",
"spring_eureka_registry",
"spring_gateway",
"subscriptions_holder",
"t_coubs_initiator",
"coub_forwarder_telegram_bot"
]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Retrieve Version
run: echo "VERSION_NAME=$(${{ github.workspace }}/gradlew -q printVersion)" >> "$GITHUB_OUTPUT"
id: project_version
- name: Get version
run: echo "version_name=${{steps.project_version.outputs.VERSION_NAME}}" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow
# Except GITHUB_TOKEN,
# secrets are not passed to the runner when
# a workflow is triggered from a forked repository.
- name: docker build
uses: docker/build-push-action@v6
with:
context: .
build-args: |
JAR_VERSION=${{ env.version_name }}
file: ./Dockerfile.${{ matrix.docker-file }}
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKERHUB_USERNAME || 'docker.io' }}/${{ matrix.docker-file }}:${{ env.version_name }}
push: false