Skip to content

Update docker_build.yml #48

Update docker_build.yml

Update docker_build.yml #48

Workflow file for this run

# Build and publish container images
#
# There are three images in this repo we want to build and publish individually:
# - GISPy
# - ISIS
# - ASP
#
# The images should be tagged as 'latest' and "$VERSION", where the version
# will point unequivocally to a git commit/tag of this repo.
# 'latest' will be the latest version of repository in 'stable' branch.
#
# Reference docs:
# - docs.github.com/en/actions/publishing-packages/publishing-docker-images
name: Build and Publish Containers
# Controls when the action will run. Triggers the workflow on push request, or repository dispatch
on:
# Runs when pushing to 'stable' branch
push:
# branches:
# - 'stable'
# - 'test'
branches-ignore:
- 'master'
tags:
- '*'
# Run in every PR too
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# gispy:
# uses: ./.github/workflows/workflow_build.yml
# with:
# image_name: ${{ vars.DOCKERHUB_USERNAME }}/jupyter-gispy
# context_path: ./dockerfiles
# dockerfile_path: ./dockerfiles/gispy.dockerfile
# secrets: inherit
# isis:
# uses: ./.github/workflows/workflow_build.yml
# with:
# image_name: ${{ vars.DOCKERHUB_USERNAME }}/jupyter-isis
# context_path: ./dockerfiles
# dockerfile_path: ./dockerfiles/isis.dockerfile
# secrets: inherit
gispy:
runs-on: ubuntu-latest
steps:
- # https://github.com/marketplace/actions/checkout
name: Checkout
uses: actions/checkout@v4
# - # Add ISIS_OUTPUT_TAG var to env
# name: Workaround to define base-image for ASP
# run: |
# ISIS_OUTPUT_TAG=$(echo "${DOCKER_METADATA_OUTPUT_TAGS}" | head -n1 | cut -d" " -f1)
# echo "ISIS_OUTPUT_TAG=${ISIS_OUTPUT_TAG}" >> "$GITHUB_ENV"
- name: Build image
run: |
docker compose -f compose.build.yml build jupyter-gispy
- name: List images
run: docker image ls -a
- name: Tag image
if: ${{ github.event_name == 'push' }}
env:
USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images jupyter-gispy`
docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$GITHUB_REF_NAME
# IMAGE_SHA=`docker images -q $NEW_IMAGE`
# docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$IMAGE_SHA
- name: List images
run: docker image ls -a
- # https://github.com/marketplace/actions/docker-login
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
env:
USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run: >
docker image ls
| sort "${USERNAME}/jupyter-gispy"
| xargs -I'{}' docker push {}