|
57 | 57 | - name: Build |
58 | 58 | run: npm run build |
59 | 59 |
|
60 | | - - name: Upload production assets |
61 | | - if: github.event_name != 'pull_request' |
62 | | - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
63 | | - with: |
64 | | - name: production-assets-${{ github.sha }} |
65 | | - path: dist/ |
66 | | - if-no-files-found: error |
67 | | - retention-days: 1 |
68 | | - |
69 | 60 | database-tests: |
70 | 61 | if: github.event_name == 'pull_request' |
71 | 62 | runs-on: ubuntu-latest |
@@ -148,59 +139,3 @@ jobs: |
148 | 139 | playwright-report/ |
149 | 140 | if-no-files-found: ignore |
150 | 141 | retention-days: 7 |
151 | | - |
152 | | - docker: |
153 | | - if: github.event_name != 'pull_request' |
154 | | - needs: quality |
155 | | - runs-on: ubuntu-latest |
156 | | - env: |
157 | | - DOCKER_PUSH: ${{ github.event_name == 'push' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }} |
158 | | - steps: |
159 | | - - name: Checkout code |
160 | | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
161 | | - with: |
162 | | - persist-credentials: false |
163 | | - |
164 | | - - name: Download production assets |
165 | | - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
166 | | - with: |
167 | | - name: production-assets-${{ github.sha }} |
168 | | - path: dist/ |
169 | | - |
170 | | - - name: Set up QEMU |
171 | | - if: env.DOCKER_PUSH == 'true' |
172 | | - uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4.3.0 |
173 | | - |
174 | | - - name: Set up Docker Buildx |
175 | | - if: env.DOCKER_PUSH == 'true' |
176 | | - uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0 |
177 | | - |
178 | | - - name: Login to Docker Hub |
179 | | - if: env.DOCKER_PUSH == 'true' |
180 | | - uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 |
181 | | - with: |
182 | | - username: ${{ secrets.DOCKER_USERNAME }} |
183 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
184 | | - |
185 | | - # Create a minimal Dockerfile for multi-arch that just uses pre-built assets |
186 | | - - name: Create production Dockerfile |
187 | | - if: env.DOCKER_PUSH == 'true' |
188 | | - run: | |
189 | | - cat > Dockerfile.prod << 'EOF' |
190 | | - FROM nginx:alpine |
191 | | - RUN rm -rf /usr/share/nginx/html/* |
192 | | - COPY dist /usr/share/nginx/html |
193 | | - COPY nginx.conf /etc/nginx/conf.d/default.conf |
194 | | - EXPOSE 80 |
195 | | - CMD ["nginx", "-g", "daemon off;"] |
196 | | - EOF |
197 | | -
|
198 | | - - name: Build and push |
199 | | - if: env.DOCKER_PUSH == 'true' |
200 | | - uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 |
201 | | - with: |
202 | | - context: . |
203 | | - file: Dockerfile.prod |
204 | | - push: ${{ env.DOCKER_PUSH == 'true' }} |
205 | | - tags: adamgaborjaniszabo/debate-trainer:latest |
206 | | - platforms: linux/amd64,linux/arm64 |
0 commit comments