-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (56 loc) · 2.18 KB
/
docker_build_base_jupyter.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI(base-jupyter)
on:
push:
branches: [ "main" ]
paths: [
"base/jupyter/**",
".github/workflows/docker_build_base_jupyter.yml",
]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, closed]
paths: [
"base/jupyter/**",
".github/workflows/docker_build_base_jupyter.yml",
]
env:
IMAGE_NAME: jupyter
VERSION: 1.8.0-cu12.1.1-ubuntu22.04
DOCKERFILE: jupyter-1.8.Dockerfile
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
steps:
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Build Docker images
run: docker build -f base/jupyter/${{ env.DOCKERFILE }} -t saz0568/zelos-image:${{ env.IMAGE_NAME }}-${{ env.VERSION }} .
- name: Push Docker images
run: docker push saz0568/zelos-image:${{ env.IMAGE_NAME }}-${{ env.VERSION }}
publish:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true }}
steps:
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Pull Docker image from DockerHub
run: docker pull saz0568/zelos-image:${{ env.IMAGE_NAME }}-${{ env.VERSION }}
- name: Log in to zelos Harbor
run: echo "${{ secrets.HARBOR_PASSWORD }}" | docker login harbor.zelostech.com.cn:5443 --username=${{ secrets.HARBOR_USERNAME }} --password-stdin
- name: Tag Harbor images
run: docker tag saz0568/zelos-image:${{ env.IMAGE_NAME }}-${{ env.VERSION }} harbor.zelostech.com.cn:5443/devops/jupyter/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Push Harbor images
run: docker push harbor.zelostech.com.cn:5443/devops/jupyter/${{ env.IMAGE_NAME }}:${{ env.VERSION }}