Skip to content

Commit 0903428

Browse files
committed
Added job to build and push Docker image to repository
1 parent dcc311a commit 0903428

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build & Upload Fairspace-Jupyter Docker image
2+
3+
env:
4+
DOCKER_REGISTRY: ghcr.io
5+
6+
on:
7+
push:
8+
branches:
9+
- dev
10+
- release
11+
- devops/FAIRSPC-57_github_actions
12+
13+
jobs:
14+
build-and-upload-jupyterhub:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Get version tag for artifact
21+
run: |
22+
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
23+
echo "Building images from the branch: $BRANCH"
24+
VER=$(cat ./projects/jupyterhub-hub/VERSION)
25+
echo "Building images of version: $VER"
26+
if [ $BRANCH != "release" ]
27+
then
28+
VER=$VER-SNAPSHOT
29+
fi
30+
echo "fairspace_version=$VER" >> $GITHUB_ENV
31+
32+
- name: Log in to the Container registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.DOCKER_REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub
44+
45+
- name: Build and push Docker image
46+
uses: docker/build-push-action@v5
47+
with:
48+
context: ./projects/jupyterhub-hub/
49+
push: true
50+
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub:${{ env.VERSION }}
51+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)