Skip to content

refactor: Move pixi to /usr/bin (#51) #58

refactor: Move pixi to /usr/bin (#51)

refactor: Move pixi to /usr/bin (#51) #58

Workflow file for this run

# Any commit to master branch re-builds images, re-runs tests, and pushes SHA tags to DockerHub
name: Build
on:
push:
branches:
- main
paths-ignore:
- 'LICENSE'
- 'README.md'
workflow_dispatch:
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_ORG: ${{ github.repository_owner }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
IMAGE_PLATFORMS: linux/amd64,linux/arm64
jobs:
build-base:
env:
IMAGE: base-image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get date tag
id: get_date
run: |
DATE_TAG="$( date -u '+%Y.%m.%d' )"
echo "date_tag=$DATE_TAG" >> $GITHUB_OUTPUT
- name: Get registry and org
id: registry_org
run: |
ORG=$(echo "${{ env.DOCKER_ORG }}" | tr '[:upper:]' '[:lower:]')
echo "image_base=${{ env.DOCKER_REGISTRY }}/${ORG}" >> $GITHUB_OUTPUT
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
- name: Free up disk space
run: |
df -h
docker image ls
sudo apt clean
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
df -h
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.registry_org.outputs.image_base }}/${{ env.IMAGE }}
tags: |
# set latest tag for default branch
type=raw,value=latest
type=raw,value=${{ steps.get_date.outputs.date_tag }}
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
context: ${{ env.IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
build-images:
needs: build-base
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
IMAGE: [base-ssec-project,project-ans-modeling,tutorial-scipy-2024]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get date tag
id: get_date
run: |
DATE_TAG="$( date -u '+%Y.%m.%d' )"
echo "date_tag=$DATE_TAG" >> $GITHUB_OUTPUT
- name: Get registry and org
id: registry_org
run: |
ORG=$(echo "${{ env.DOCKER_ORG }}" | tr '[:upper:]' '[:lower:]')
echo "image_base=${{ env.DOCKER_REGISTRY }}/${ORG}" >> $GITHUB_OUTPUT
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
- name: Free up disk space
run: |
df -h
docker image ls
sudo apt clean
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
df -h
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.registry_org.outputs.image_base }}/${{ matrix.IMAGE }}
tags: |
# set latest tag for default branch
type=raw,value=latest
type=raw,value=${{ steps.get_date.outputs.date_tag }}
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
context: ${{ matrix.IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
- name: Inspect Image
run: |
docker run ${{ steps.registry_org.outputs.image_base }}/${{ matrix.IMAGE }}:latest micromamba list
docker run ${{ steps.registry_org.outputs.image_base }}/${{ matrix.IMAGE }}:latest pip list
docker images
- name: Test Image
run: |
docker run -u 1000 -w /srv/test -v $PWD:/srv/test ${{ steps.registry_org.outputs.image_base }}/${{ matrix.IMAGE }}:latest