-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (31 loc) · 1.12 KB
/
build.yml
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
name: Build Docker Image
on:
workflow_call:
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
jobs:
build_candidate:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Docker registry
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login harbor.main.rise-ck8s.com -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Print image tag
run: |
echo "Candidate Image Tag: ${{ github.sha }}"
- name: Pull latest image as cache
run: |
docker pull harbor.main.rise-ck8s.com/des-public/tutorials:latest || true
- name: Build Docker image using cache
run: |
docker build --cache-from harbor.main.rise-ck8s.com/des-public/tutorials:latest \
-t harbor.main.rise-ck8s.com/des-public/tutorials:${{ github.sha }} .
- name: Upload Docker image
run: |
docker push harbor.main.rise-ck8s.com/des-public/tutorials:${{ github.sha }}