Update docker-back.yaml #97
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: Backend Docker Image Build | |
on: | |
push: | |
paths: | |
- "back/**" | |
- ".github/workflows/docker-back.yaml" | |
- "back-prod.Dockerfile" | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
BackImageBuild: | |
name: Build openchokin/back Custom Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack notification of build start | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_COLOR: "#4381de" | |
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
SLACK_TITLE: Start openchokin/back image build | |
SLACK_MESSAGE: | | |
Run number : #${{ github.run_number }} | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: walnuts1018 | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
with: | |
version: latest | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx | |
restore-keys: | | |
${{ runner.os }}-buildx | |
- name: Build and push Docker images | |
uses: docker/[email protected] | |
if: github.event_name != 'release' | |
with: | |
push: true | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
file: ./back-prod.Dockerfile | |
tags: | | |
ghcr.io/walnuts1018/openchokin-back:latest | |
ghcr.io/walnuts1018/openchokin-back:v0.0.0-${{ github.sha }}-${{ github.run_number }} | |
SucceessNotification: | |
if: ${{ success() }} | |
name: Send Success Message | |
needs: [BackImageBuild] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Message to Slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
SLACK_TITLE: openchokin/back id:mage build succeeded | |
SLACK_MESSAGE: | | |
Run number : #${{ github.run_number }} | |
Image tag : ${{ github.sha }}-${{ github.run_number }} | |
Image URL : | |
FailureAlert: | |
if: ${{ failure() }} | |
name: Notify failure | |
needs: [BackImageBuild] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Failure Alert to Slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
SLACK_TITLE: openchokin/back image build failed | |
SLACK_COLOR: danger | |
SLACK_MESSAGE: | | |
openchokin/back image build failed | |
Run number : #${{ github.run_number }} SLACK_MESSAGE: "Run number : #${{ github.run_number }}" |