@@ -113,24 +113,85 @@ jobs:
113113 file : ./services/app/assp/codebattle/cover/excoveralls.json
114114 fail_ci_if_error : false
115115
116+ codebattle-docker-matrix :
117+ if : github.repository == 'hexlet-codebattle/codebattle'
118+ runs-on : ubuntu-latest
119+ timeout-minutes : 30 # Add timeout to prevent hanging builds
120+ needs : build
121+
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+
133+ steps :
134+ - uses : actions/checkout@v4
135+
136+ - name : Set up Docker Buildx
137+ uses : docker/setup-buildx-action@v3
138+
116139 - name : Login to Docker Hub
117140 uses : docker/login-action@v3
118141 with :
119142 username : ${{ secrets.DOCKER_USERNAME }}
120143 password : ${{ secrets.DOCKER_PASSWORD }}
121144
145+ - name : Build codebattle ${{ matrix.target }}
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 : ${{ 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
157+
158+ runner-docker-matrix :
159+ if : github.repository == 'hexlet-codebattle/codebattle'
160+ runs-on : ubuntu-latest
161+ timeout-minutes : 30 # Add timeout to prevent hanging builds
162+ needs : build
163+
164+ strategy :
165+ matrix :
166+ target :
167+ - compile-image
168+ - runtime-image
169+ include :
170+ - target : runtime-image
171+ tag : latest
172+
173+ steps :
174+ - uses : actions/checkout@v4
175+
122176 - name : Set up Docker Buildx
123177 uses : docker/setup-buildx-action@v3
124178
125- - name : Build and push codebattle image
126- run : |
127- make GIT_HASH=${{ github.sha }} docker-build-codebattle
128- make docker-push-codebattle
179+ - name : Login to Docker Hub
180+ uses : docker/login-action@v3
181+ with :
182+ username : ${{ secrets.DOCKER_USERNAME }}
183+ password : ${{ secrets.DOCKER_PASSWORD }}
129184
130- - name : Build and push runner image
131- run : |
132- make docker-build-runner
133- make docker-push-runner
185+ - name : Build runner ${{ matrix.target }}
186+ uses : docker/build-push-action@v6
187+ with :
188+ context : services/app
189+ file : services/app/Dockerfile.runner
190+ 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
134195
135196 # stop integratoin tests on CI becaues of https://github.com/hexlet-codebattle/codebattle/runs/580337561?check_suite_focus=true
136197 # - name: Pull dockers
0 commit comments