Skip to content

Commit

Permalink
Add GitHub workflow used to build the karmada-dashboard image
Browse files Browse the repository at this point in the history
Signed-off-by: dev <cossjie@foxmail.com>

Update karmada-dashboard.yaml

Signed-off-by: dev <cossjie@foxmail.com>

Add GitHub workflow used to build the karmada-dashboard image

Signed-off-by: dev <cossjie@foxmail.com>
  • Loading branch information
devadapter committed Jan 5, 2022
1 parent a52f0d3 commit 69d5a2f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Image-Build-And-Push

on:
push:
branches: [main]

jobs:
build-and-push:
# prevent job running from forked repository, otherwise
# 1. running on the forked repository would fail as missing necessary secret.
# 2. running on the forked repository would use unnecessary GitHub Action time.
if: ${{ github.repository == 'karmada-io/dashboard' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
echo "start build"
npm install
npm run build
docker build . --file Dockerfile --tag ${{ secrets.IMAGE_REPOSITORY }}/${{ secrets.IMAGE_NAME }}:${{ secrets.IMAGE_VERSION }}
- name: Login in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: |
echo "push image"
docker push ${{ secrets.IMAGE_REPOSITORY }}/${{ secrets.IMAGE_NAME }}:${{ secrets.IMAGE_VERSION }}
4 changes: 2 additions & 2 deletions deploy/karmada-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
app: frontend
spec:
containers:
- image: jcce/karmada-dashboard:v0.1.0
- image: jcce/karmada-dashboard:latest
name: frontend
imagePullPolicy: IfNotPresent
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
Expand Down

0 comments on commit 69d5a2f

Please sign in to comment.