This repository has been archived by the owner on Dec 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (107 loc) · 3.7 KB
/
docker-front.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Front Docker Image Build
on:
push:
branches:
- main
workflow_dispatch:
jobs:
ImageBuild:
name: Build openchokin/front 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/front 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: setup-node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: front
- name: Cache node_modules
id: node_modules_cache_id
env:
cache-name: cache-node-modules
uses: actions/cache@v3
with:
path: "front/node_modules"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('front/package-lock.json') }}
- name: Cache next
id: next-cache
env:
cache-name: cache-next
uses: actions/cache@v3
with:
path: "front/.next/cache"
key: ${{ runner.os }}-nextjs-${{ hashFiles('front/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
- name: npm install
working-directory: ./front
run: npm install
- name: npm build
working-directory: ./front
run: npm run build
- name: Build and push Docker images
uses: docker/[email protected]
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
file: ./front-prod.Dockerfile
tags: |
ghcr.io/walnuts1018/openchokin-front:latest
ghcr.io/walnuts1018/openchokin-front:v0.0.0-${{ github.sha }}-${{ github.run_number }}
SucceessNotification:
if: ${{ success() }}
name: Send Success Message
needs: [ImageBuild]
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/front image build succeeded
SLACK_MESSAGE: |
openchokin/front image build succeeded
Image: openchokin/front
Run number : #${{ github.run_number }}
FailureAlert:
if: ${{ failure() }}
name: Notify failure
needs: [ImageBuild]
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/front image build failed
SLACK_COLOR: danger
SLACK_MESSAGE: |
openchokin/front image build failed
Image: openchokin/front
Run number : #${{ github.run_number }}