Dockerize of production version. Triggerd by J-Hoplin #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-Production-Dockerize | |
on: | |
push: | |
branches: | |
- production | |
run-name: Dockerize of production version. Triggerd by ${{github.actor}} | |
jobs: | |
dockerize: | |
name: Dockerize and upload | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repository code | |
- name: Repository Checkout | |
uses: actions/checkout@v4 | |
# Set Node.js version environment | |
- name: Node.js version 18 Environment setting | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
# Install dependencies | |
- name: Install Dependencies | |
run: npm install --force | |
- name: Check Build Status | |
run: npm run build | |
- name: Setup QEMU for multiplatform build | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup docker buildx and set platform | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- id: build-n-push | |
name: Build and Push | |
uses: docker/build-push-action@v5 | |
continue-on-error: true | |
with: | |
context: . | |
push: true | |
tags: hoplindev/online-judge:latest | |
platforms: linux/amd64,linux/arm64 | |
- name: 'Discord Alert - Success' | |
if: steps.build-n-push.outcome == 'success' | |
uses: rjstone/discord-webhook-notify@v1 | |
with: | |
severity: info | |
details: 'Docker Deploy Success - Architecture: linux/amd64, linux/arm64' | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | |
- name: 'Discord Alert - Fail' | |
if: steps.build-n-push.outcome != 'success' | |
uses: rjstone/discord-webhook-notify@v1 | |
with: | |
severity: error | |
details: 'Docker Deploy Failed' | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | |
- name: 'Fail check' | |
if: steps.build-n-push.outcome != 'success' | |
run: exit1 |