-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 2.93 KB
/
build_and_upload_docker_image_on_push.yaml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Build & Upload Fairspace-Jupyter Docker image
on:
push:
branches:
- dev
- release
- devops/FAIRSPC-57_github_actions
jobs:
build-and-upload-jupyterhub:
name: Build & Upload Fairspace-Jupyter (K8s Hub) Docker image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Get version tag for artifact
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Building images from the branch: $BRANCH"
VER=$(cat ./projects/jupyterhub-hub/VERSION)
echo "Building images of version: $VER"
if [ $BRANCH != "release" ]
then
VER=$VER-SNAPSHOT
fi
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./projects/jupyterhub-hub/
push: true
tags: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}
build-and-upload-jupyterhub-singleuser:
name: Build & Upload Fairspace-Jupyter (Single User) Docker image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Get version tag for artifact
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Building images from the branch: $BRANCH"
VER=$(cat ./projects/jupyterhub-singleuser/VERSION)
echo "Building images of version: $VER"
if [ $BRANCH != "release" ]
then
VER=$VER-SNAPSHOT
fi
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-singleuser
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./projects/jupyterhub-singleuser/
push: true
tags: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-singleuser:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}