Skip to content

Merge pull request #57 from SCiO-systems/actions-issue #25

Merge pull request #57 from SCiO-systems/actions-issue

Merge pull request #57 from SCiO-systems/actions-issue #25

name: Build and Push Docker Images (jupyter-eiaspatial-notebook-jammy)
on:
push:
branches:
- develop
- main
paths:
- '.github/workflows/pipeline-jupyter-eiaspatial-notebook-jammy.yml'
- 'jupyter-eiaspatial-notebook/jammy/**'
permissions:
contents: read
jobs:
build_and_push_dev:
runs-on: "self-hosted"
if: startsWith(github.ref, 'refs/heads/develop')
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get short SHA
uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Docker Image (dev)
uses: docker/build-push-action@v4
with:
context: ./jupyter-eiaspatial-notebook/jammy
file: ./jupyter-eiaspatial-notebook/jammy/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:dev-jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }}-${{ steps.short-sha.outputs.sha }}
${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:dev-jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
build_and_push_prod:
runs-on: "self-hosted"
if: startsWith(github.ref, 'refs/heads/main')
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Pull "dev" Docker image
run: docker pull ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:dev-jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }}
- name: Tag producion Docker image
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:dev-jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }}
- name: Push Docker image
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }}
- name: Tag producion Docker image (non specified version)
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:jammy-${{ secrets.JUPYTER_EIASPATIAL_NOTEBOOK_RELEASE_VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:jammy
- name: Push Docker image (non specified version)
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/jupyter-eiaspatial-notebook:jammy