🐳 Attempt 3 (fixed): Use --build-arg and ARG for DEPS_HASH

This commit is contained in:
2026-04-09 11:35:43 +02:00
parent 9937f814f6
commit 2404983627

View File

@@ -54,21 +54,22 @@ jobs:
source VERSION source VERSION
IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
# Use the calculated dependency hash and export it # Use the calculated dependency hash and set it as environment variable
DEPS_HASH="${{ steps.calc_hash.outputs.deps_hash }}" DEPS_HASH="${{ steps.calc_hash.outputs.deps_hash }}"
echo "Using dependency hash: $DEPS_HASH" echo "Using dependency hash: $DEPS_HASH"
export DEPS_HASH echo "DEPS_HASH=$DEPS_HASH" >> $GITHUB_ENV
TAGS="$IMAGE_VERSION latest ${{ github.sha }}" TAGS="$IMAGE_VERSION latest ${{ github.sha }}"
echo "Building Docker image with tags: $TAGS" echo "Building Docker image with tags: $TAGS"
# Build the production image using inline version with prebuilt cache image # Build the production image using inline version with prebuilt cache image
# Fixed: Proper working directory and source code copying # Fixed: Use $GITHUB_ENV variable in the inline Dockerfile
docker build -t dance-lessons-coach -f - . <<EOF docker build -t dance-lessons-coach -f - --build-arg DEPS_HASH . <<EOF
# dance-lessons-coach Production Docker Image # dance-lessons-coach Production Docker Image
# Inline Dockerfile using prebuilt cache image # Inline Dockerfile using prebuilt cache image
# Use the build cache image as base # Use the build cache image as base
ARG DEPS_HASH
FROM gitea.arcodange.lab/arcodange/dance-lessons-coach-build-cache:${DEPS_HASH} AS builder FROM gitea.arcodange.lab/arcodange/dance-lessons-coach-build-cache:${DEPS_HASH} AS builder
# Copy source code to the correct working directory # Copy source code to the correct working directory