🐳 Attempt 3: Inline version using prebuilt cache image
This commit is contained in:
@@ -61,8 +61,48 @@ jobs:
|
|||||||
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 actual docker/Dockerfile (no inline)
|
# Build the production image using inline version with prebuilt cache image
|
||||||
docker build -t dance-lessons-coach -f docker/Dockerfile .
|
docker build -t dance-lessons-coach -f - . <<'EOF'
|
||||||
|
# dance-lessons-coach Production Docker Image
|
||||||
|
# Inline Dockerfile using prebuilt cache image
|
||||||
|
|
||||||
|
# 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
|
for TAG in $TAGS; do
|
||||||
IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG"
|
IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG"
|
||||||
|
|||||||
Reference in New Issue
Block a user