Skip to content

Commit dd4e4e8

Browse files
committed
add image build
1 parent faa7123 commit dd4e4e8

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/docker.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build Docker Image
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
ImageBuild:
8+
name: Build Code-Server-Operator Custom Docker Image
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Slack notification of build start
12+
uses: rtCamp/action-slack-notify@v2
13+
env:
14+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
15+
SLACK_USERNAME: GitHub Actions
16+
SLACK_COLOR: "#4381de"
17+
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
18+
SLACK_TITLE: Start Code-Server-Operator image build
19+
SLACK_MESSAGE: |
20+
Run number : #${{ github.run_number }}
21+
22+
- name: Check out
23+
uses: actions/checkout@v4
24+
25+
- name: Login to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: walnuts1018
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Set up Docker Buildx
33+
id: buildx
34+
uses: docker/setup-buildx-action@v3
35+
with:
36+
version: latest
37+
38+
- name: Get Tag from Release
39+
run: echo "ImageTag=${GITHUB_REF##*/}" >> $GITHUB_ENV
40+
41+
- name: Build and push Docker images
42+
uses: docker/build-push-action@v5
43+
with:
44+
push: true
45+
context: .
46+
platforms: linux/amd64,linux/arm64
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max
49+
tags: |
50+
ghcr.io/walnuts1018/code-server-operator:latest
51+
ghcr.io/walnuts1018/code-server-operator:${{ github.event.release.tag_name }}
52+
53+
SucceessNotification:
54+
if: ${{ success() }}
55+
name: Send Success Message
56+
needs: [ImageBuild]
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Send Message to Slack
60+
uses: rtCamp/action-slack-notify@v2
61+
env:
62+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
63+
SLACK_USERNAME: GitHub Actions
64+
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
65+
SLACK_TITLE: Code-Server-Operator image build succeeded
66+
SLACK_MESSAGE: |
67+
Image: Code-Server-Operator
68+
Run number : #${{ github.run_number }}
69+
70+
FailureAlert:
71+
if: ${{ failure() }}
72+
name: Notify failure
73+
needs: [ImageBuild]
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Send Failure Alert to Slack
77+
uses: rtCamp/action-slack-notify@v2
78+
env:
79+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
80+
SLACK_USERNAME: GitHub Actions
81+
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
82+
SLACK_TITLE: Code-Server-Operator image build failed
83+
SLACK_COLOR: danger
84+
SLACK_MESSAGE: |
85+
Image: Code-Server-Operator
86+
Run number : #${{ github.run_number }}

0 commit comments

Comments
 (0)