Skip to content
Open
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
29 changes: 23 additions & 6 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This workflow will perform following actions when code is pushed to the main branch:
# - Run tests and linting checks (can be enabled via needs: test_and_lint)
# - Build and push nmrKit Docker image with layer caching for faster builds
# - Build and push nmrKit Docker image with latest and release-version tags
# - Conditionally build nmr-cli image only if files in app/scripts/nmr-cli/ changed
# - Push images to Docker Hub under namespace nfdi4chem with latest tag
# - Push images to Docker Hub under namespace nfdi4chem with latest tags (plus release-version tags)
# - Prevent redundant builds using concurrency control
#
# Maintainers:
Expand Down Expand Up @@ -93,15 +93,30 @@ jobs:
nmr-cli:
- 'app/scripts/nmr-cli/**'

# Read release version from app config for versioned Docker tags
- name: Read project release version
id: release_version
shell: bash
run: |
PROJECT_VERSION=$(sed -nE 's/^VERSION\s*=\s*"([^"]+)"/\1/p' app/core/config.py | head -n1)
if [[ -z "$PROJECT_VERSION" ]]; then
echo "Unable to read VERSION from app/core/config.py"
exit 1
fi
echo "project_version=$PROJECT_VERSION" >> "$GITHUB_OUTPUT"
echo "Detected release version: $PROJECT_VERSION"

# Build main nmrKit image with registry caching for faster builds
- name: Build and push nmrKit Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
build-args: RELEASE_VERSION=${{ env.RELEASE_TAG }}
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }}
build-args: RELEASE_VERSION=${{ steps.release_version.outputs.project_version }}
tags: |
${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }}
${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ steps.release_version.outputs.project_version }}
cache-from: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:buildcache,mode=max

Expand All @@ -113,7 +128,9 @@ jobs:
context: ./app/scripts/nmr-cli/
file: ./app/scripts/nmr-cli/Dockerfile
push: true
build-args: RELEASE_VERSION=${{ env.RELEASE_TAG }}
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }}
build-args: RELEASE_VERSION=${{ steps.release_version.outputs.project_version }}
tags: |
${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }}
${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ steps.release_version.outputs.project_version }}
cache-from: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:buildcache,mode=max
Loading