Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DASHBOARD: Add github workflow used to build the karmada-dashboard image #5

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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