Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/apptainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-FileCopyrightText: 2026 GFZ Helmholtz Centre for Geosciences
# SPDX-FileContributor: Sahil Jhawar
#
# SPDX-License-Identifier: Apache-2.0
name: Build and Push Apptainer Image

on:
push:
branches: [main]
paths:
- "*.def"
- "swvo/**"
- "pyproject.toml"
- "requirements.txt"
- "download_daily_files.py"
workflow_dispatch:

env:
APPTAINER_VERSION: "1.5.3"
IMAGE_NAME: swvo
Comment thread
sahiljhawar marked this conversation as resolved.

jobs:
build-and-push:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v7

- name: Get SWVO package version
id: swvo_version
run: |
VERSION=$(grep -oP '(?<=^current_version = ")[^"]+' pyproject.toml)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Install Apptainer
run: |
wget https://github.com/apptainer/apptainer/releases/download/v${{ env.APPTAINER_VERSION }}/apptainer_${{ env.APPTAINER_VERSION }}_amd64.deb
sudo apt-get update
sudo apt-get install -y ./apptainer_${{ env.APPTAINER_VERSION }}_amd64.deb
Comment thread
sahiljhawar marked this conversation as resolved.

- name: Build image
run: sudo apptainer build ${{ env.IMAGE_NAME }}.sif swvo.def
Comment thread
sahiljhawar marked this conversation as resolved.

- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} | apptainer remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io

- name: Push image
run: |
apptainer push ${{ env.IMAGE_NAME }}.sif oras://ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
apptainer push ${{ env.IMAGE_NAME }}.sif oras://ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
apptainer push ${{ env.IMAGE_NAME }}.sif oras://ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.swvo_version.outputs.version }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ push = true
[tool.bumpver.file_patterns]
"pyproject.toml" = ['current_version = "{version}"']
"swvo/__init__.py" = ['__version__ = "{version}"']
"swvo.def" = [' Version {version}']

[tool.ty.src]
include = ["swvo"]
Expand Down
36 changes: 36 additions & 0 deletions swvo.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-FileCopyrightText: 2026 GFZ Helmholtz Centre for Geosciences
# SPDX-FileContributor: Sahil Jhawar
#
# SPDX-License-Identifier: Apache-2.0

Bootstrap: docker
From: astral/uv:python3.12-bookworm-slim

%labels
Author Sahil Jhawar
Description SWVO
Version 1.2.5

%files
swvo /opt/swvo/
pyproject.toml /opt/swvo/
requirements.txt /opt/swvo/
download_daily_files.py /opt/swvo/

%environment
export UV_PROJECT_ENVIRONMENT=/opt/swvo/.venv
export PATH="/opt/swvo:/opt/swvo/.venv/bin:/root/.local/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

%post
apt-get update
apt-get install -y --no-install-recommends curl ca-certificates build-essential
rm -rf /var/lib/apt/lists/*

export PATH="/root/.local/bin:$PATH"
export UV_PROJECT_ENVIRONMENT=/opt/swvo/.venv

cd /opt/swvo/
uv sync

%runscript
exec "$@"
Loading