Skip to content

Commit a106beb

Browse files
committed
fix docker builds
1 parent af72eac commit a106beb

File tree

1 file changed

+62
-36
lines changed

1 file changed

+62
-36
lines changed

.github/workflows/master.yml

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,13 @@ jobs:
113113
file: ./services/app/assp/codebattle/cover/excoveralls.json
114114
fail_ci_if_error: false
115115

116-
codebattle-docker-matrix:
116+
codebattle-docker:
117117
if: github.repository == 'hexlet-codebattle/codebattle'
118118
runs-on: ubuntu-latest
119119
timeout-minutes: 30 # Add timeout to prevent hanging builds
120120
needs: build
121121

122-
strategy:
123-
matrix:
124-
target:
125-
- assets-image
126-
- compile-image
127-
- nginx-assets
128-
- runtime-image
129-
include:
130-
- target: runtime-image
131-
tag: latest
132-
133122
steps:
134-
- uses: actions/checkout@v4
135-
136123
- name: Set up Docker Buildx
137124
uses: docker/setup-buildx-action@v3
138125

@@ -142,37 +129,65 @@ jobs:
142129
username: ${{ secrets.DOCKER_USERNAME }}
143130
password: ${{ secrets.DOCKER_PASSWORD }}
144131

145-
- name: Build codebattle ${{ matrix.target }}
132+
- name: Build codebattle assets-image
133+
uses: docker/build-push-action@v6
134+
with:
135+
context: services/app
136+
file: services/app/Dockerfile.codebattle
137+
build-args: |
138+
GIT_HASH=${{ github.sha }}
139+
push: ${{ github.ref_name == 'master' }}
140+
target: assets-image
141+
tags: codebattle/codebattle:assets-image
142+
cache-to: type=registry,ref=codebattle/codebattle:assets-image-buildcache
143+
cache-from: type=registry,ref=codebattle/codebattle:assets-image-buildcache,image-manifest=true
144+
145+
- name: Build codebattle compile-image
146+
uses: docker/build-push-action@v6
147+
with:
148+
context: services/app
149+
file: services/app/Dockerfile.codebattle
150+
build-args: |
151+
GIT_HASH=${{ github.sha }}
152+
push: ${{ github.ref_name == 'master' }}
153+
target: compile-image
154+
tags: codebattle/codebattle:compile-image
155+
cache-to: type=registry,ref=codebattle/codebattle:compile-image-buildcache
156+
cache-from: type=registry,ref=codebattle/codebattle:compile-image-buildcache,image-manifest=true
157+
158+
- name: Build codebattle nginx-assets
159+
uses: docker/build-push-action@v6
160+
with:
161+
context: services/app
162+
file: services/app/Dockerfile.codebattle
163+
build-args: |
164+
GIT_HASH=${{ github.sha }}
165+
push: ${{ github.ref_name == 'master' }}
166+
target: nginx-assets
167+
tags: codebattle/codebattle:nginx-assets
168+
cache-to: type=registry,ref=codebattle/codebattle:nginx-assets-buildcache
169+
cache-from: type=registry,ref=codebattle/codebattle:nginx-assets-buildcache,image-manifest=true
170+
171+
- name: Build codebattle runtime-image
146172
uses: docker/build-push-action@v6
147173
with:
148174
context: services/app
149175
file: services/app/Dockerfile.codebattle
150176
build-args: |
151177
GIT_HASH=${{ github.sha }}
152178
push: ${{ github.ref_name == 'master' }}
153-
target: ${{ matrix.target }}
154-
tags: codebattle/codebattle:${{ matrix.tag != '' && matrix.tag|| matrix.target }}
155-
cache-to: type=registry,ref=codebattle/codebattle:${{ matrix.target }}-buildcache
156-
cache-from: type=registry,ref=codebattle/codebattle:${{ matrix.target }}-buildcache,image-manifest=true
179+
target: runtime-image
180+
tags: codebattle/codebattle:latest
181+
cache-to: type=registry,ref=codebattle/codebattle:runtime-image-buildcache
182+
cache-from: type=registry,ref=codebattle/codebattle:runtime-image-buildcache,image-manifest=true
157183

158-
runner-docker-matrix:
184+
runner-docker:
159185
if: github.repository == 'hexlet-codebattle/codebattle'
160186
runs-on: ubuntu-latest
161187
timeout-minutes: 30 # Add timeout to prevent hanging builds
162188
needs: build
163189

164-
strategy:
165-
matrix:
166-
target:
167-
- compile-image
168-
- runtime-image
169-
include:
170-
- target: runtime-image
171-
tag: latest
172-
173190
steps:
174-
- uses: actions/checkout@v4
175-
176191
- name: Set up Docker Buildx
177192
uses: docker/setup-buildx-action@v3
178193

@@ -182,16 +197,27 @@ jobs:
182197
username: ${{ secrets.DOCKER_USERNAME }}
183198
password: ${{ secrets.DOCKER_PASSWORD }}
184199

185-
- name: Build runner ${{ matrix.target }}
200+
- name: Build runner compile-image
201+
uses: docker/build-push-action@v6
202+
with:
203+
context: services/app
204+
file: services/app/Dockerfile.runner
205+
push: ${{ github.ref_name == 'master' }}
206+
target: compile-image
207+
tags: codebattle/runner:compile-image
208+
cache-to: type=registry,ref=codebattle/runner:compile-image-buildcache
209+
cache-from: type=registry,ref=codebattle/runner:compile-image-buildcache,image-manifest=true
210+
211+
- name: Build runner runtime-image
186212
uses: docker/build-push-action@v6
187213
with:
188214
context: services/app
189215
file: services/app/Dockerfile.runner
190216
push: ${{ github.ref_name == 'master' }}
191-
target: ${{ matrix.target }}
192-
tags: codebattle/runner:${{ matrix.tag != '' && matrix.tag|| matrix.target }}
193-
cache-to: type=registry,ref=codebattle/runner:${{ matrix.target }}-buildcache
194-
cache-from: type=registry,ref=codebattle/runner:${{ matrix.target }}-buildcache,image-manifest=true
217+
target: runtime-image
218+
tags: codebattle/runner:latest
219+
cache-to: type=registry,ref=codebattle/runner:runtime-image-buildcache
220+
cache-from: type=registry,ref=codebattle/runner:runtime-image-buildcache,image-manifest=true
195221

196222
# stop integratoin tests on CI becaues of https://github.com/hexlet-codebattle/codebattle/runs/580337561?check_suite_focus=true
197223
# - name: Pull dockers

0 commit comments

Comments
 (0)