From dd1e95bbd54c6bc417e50ddb1d8b9a107726e1fa Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Thu, 9 Apr 2026 10:44:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20use=20inline=20Dockerfile?= =?UTF-8?q?=20instead=20of=20template=20to=20simplify=20build=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/docker-push.yaml | 47 +++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/docker-push.yaml b/.gitea/workflows/docker-push.yaml index 472f035..0e5a690 100644 --- a/.gitea/workflows/docker-push.yaml +++ b/.gitea/workflows/docker-push.yaml @@ -58,14 +58,51 @@ jobs: DEPS_HASH="${{ steps.calc_hash.outputs.deps_hash }}" echo "Using dependency hash: $DEPS_HASH" - # Create Dockerfile.prod from template - sed "s/{{DEPS_HASH}}/$DEPS_HASH/g" docker/Dockerfile.prod.template > docker/Dockerfile.prod - TAGS="$IMAGE_VERSION latest ${{ github.sha }}" echo "Building Docker image with tags: $TAGS" - # Build the production image - docker build -t dance-lessons-coach -f docker/Dockerfile.prod . + # Build the production image using inline Dockerfile + docker build -t dance-lessons-coach -f - . <<'EOF' + # dance-lessons-coach Production Docker Image + # Inline Dockerfile - no template needed + + # Use the build cache image as base + FROM gitea.arcodange.lab/arcodange/dance-lessons-coach-build-cache:${DEPS_HASH} AS builder + + # Set working directory and build the binary + WORKDIR /workspace + RUN go build -o dance-lessons-coach ./cmd/server + + # Final minimal image + FROM alpine:3.18 + + WORKDIR /app + + # Install minimal dependencies + RUN apk add --no-cache ca-certificates tzdata + + # Copy binary from builder + COPY --from=builder /workspace/dance-lessons-coach /app/dance-lessons-coach + + # Copy configuration + COPY config.yaml /app/config.yaml + + # Set permissions + RUN chmod +x /app/dance-lessons-coach + + # Set timezone + ENV TZ=UTC + + # Expose port + EXPOSE 8080 + + # Health check + HEALTHCHECK --interval=30s --timeout=3s \ + CMD wget -q --spider http://localhost:8080/api/health || exit 1 + + # Entry point + ENTRYPOINT ["/app/dance-lessons-coach"] + EOF for TAG in $TAGS; do IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG"