-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added job to build and push Docker image to repository
- Loading branch information
1 parent
dcc311a
commit 44be769
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
.github/workflows/build_and_upload_docker_image_on_push.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Build & Upload Fairspace-Jupyter Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- release | ||
- devops/FAIRSPC-57_github_actions | ||
|
||
jobs: | ||
build-and-upload-jupyterhub: | ||
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 }} |