🔧 ci: fix Dockerfile.prod to use proper dependency hash and add testing scripts
This commit is contained in:
@@ -227,10 +227,53 @@ jobs:
|
||||
source VERSION
|
||||
IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
|
||||
|
||||
# Generate Dockerfile.prod with correct dependency hash
|
||||
DEPS_HASH="${{ needs.build-cache.outputs.deps_hash }}"
|
||||
echo "Using dependency hash: $DEPS_HASH"
|
||||
|
||||
# Create Dockerfile.prod with the correct cache image tag
|
||||
cat > Dockerfile.prod << EOF
|
||||
# DanceLessonsCoach Production Docker Image
|
||||
# Generated by CI/CD pipeline with dependency hash: $DEPS_HASH
|
||||
|
||||
# Use the build cache image as base
|
||||
FROM gitea.arcodange.lab/arcodange/dance-lessons-coach-build-cache:$DEPS_HASH AS builder
|
||||
|
||||
# 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
|
||||
|
||||
TAGS="$IMAGE_VERSION latest ${{ github.sha }}"
|
||||
echo "Building Docker image with tags: $TAGS"
|
||||
|
||||
# Use the production Dockerfile that leverages the build cache
|
||||
# Build the production image
|
||||
docker build -t dance-lessons-coach -f Dockerfile.prod .
|
||||
|
||||
for TAG in $TAGS; do
|
||||
|
||||
Reference in New Issue
Block a user