Skip to content

Chbrandt patch 1

Chbrandt patch 1 #54

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
env:
USER_ORG: ${{ vars.DOCKERHUB_USERNAME }}
SERVICE: jupyter-gispy
REPO: ${USER_ORG}/${SERVICE}
steps:
- # https://github.com/marketplace/actions/checkout
name: Checkout
uses: actions/checkout@v4
- name: Build image
run: |
docker compose -f compose.build.yml build ${{ env.SERVICE }}
- name: List images
run: docker image ls -a
- name: Tag image
if: ${{ github.event_name == 'push' }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images ${{ env.SERVICE }}`
docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME
- name: Tag 'latest' image
if: ${{ github.ref_type == 'tag' }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images ${{ env.SERVICE }}`
DATE=`date +%Y%m%d`
docker tag $NEW_IMAGE ${{ env.REPO }}:latest
docker tag $NEW_IMAGE ${{ env.REPO }}:$DATE
# - name: Tag image with SHA hash
# if: ${{ github.event_name == 'push' }}
# run: |
# 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
run: >
docker image ls
| tail -n+2 | awk '{print $1":"$2}'
| grep "${{ env.REPO }}"
| xargs -I'{}' docker push {}
isis:
runs-on: ubuntu-latest
env:
USER_ORG: ${{ vars.DOCKERHUB_USERNAME }}
SERVICE: jupyter-isis
REPO: ${USER_ORG}/${SERVICE}
steps:
- # https://github.com/marketplace/actions/checkout
name: Checkout
uses: actions/checkout@v4
- name: Build image
run: |
docker compose -f compose.build.yml build ${{ env.SERVICE }}
- name: List images
run: docker image ls -a
- name: Tag image
if: ${{ github.event_name == 'push' }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images ${{ env.SERVICE }}`
docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME
- name: Tag 'latest' image
if: ${{ github.ref_type == 'tag' }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images ${{ env.SERVICE }}`
DATE=`date +%Y%m%d`
docker tag $NEW_IMAGE ${{ env.REPO }}:latest
docker tag $NEW_IMAGE ${{ env.REPO }}:$DATE
# - name: Tag image with SHA hash
# if: ${{ github.event_name == 'push' }}
# run: |
# 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
run: >
docker image ls
| tail -n+2 | awk '{print $1":"$2}'
| grep "${{ env.REPO }}"
| xargs -I'{}' docker push {}