Merge pull request #187 from HelikarLab/purge_r #23
Workflow file for this run
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
name: Container Build | |
on: | |
push: | |
tags: | |
- "*" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
build-and-push-image: | |
name: Build and Push Docker Image | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
packages: write | |
# A matrix platform is used here to expand functionality for building for additional architectures | |
# For example, intel/amd (linux/amd64) or Apple Silicon (arm64) | |
strategy: | |
matrix: | |
platform: [ linux/amd64 ] | |
steps: | |
# Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
# Get tag/release information for docker tags | |
- name: Docker Metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=false | |
prefix= | |
suffix= | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, 'master') }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Set up Jupyter Notebook Cleaner | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Clean Jupyter Notebook Outputs | |
run: | | |
python -m pip install --upgrade nbstripout --no-cache-dir | |
find $GITHUB_WORKSPACE -name "*.ipynb" -exec nbstripout "{}" \; | |
# Log into the GitHub Container Registry so we can push the image | |
- name: Log in to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
file: ./Dockerfile | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: ${{ matrix.platform }} | |