Refactor Dockerfile to use Google's distroless image for minimal production stage and remove unnecessary Alpine setup
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m32s

This commit is contained in:
Cameron Redmore 2025-08-08 17:09:31 +01:00
parent 20d6a8d577
commit 826723eb5b
No known key found for this signature in database

View file

@ -15,24 +15,18 @@ COPY . .
# Build the frontend with Vite and compile the server to executable
RUN bun run build
# Minimal production stage using Alpine
FROM alpine:latest
# Install CA certificates for HTTPS requests and glibc compatibility
RUN apk --no-cache add ca-certificates tzdata gcompat
# Minimal production stage using Google's distroless image (glibc-based)
FROM gcr.io/distroless/cc-debian12
WORKDIR /app
# Copy the compiled executable from the build stage (Linux build will not have .exe extension)
# Copy the compiled executable from the build stage
COPY --from=builder /app/dist/server /app/server
# Copy the built frontend assets (but ensure we don't overwrite the server executable)
COPY --from=builder /app/dist/*.html /app/dist/
COPY --from=builder /app/dist/assets /app/dist/assets
# Make the server executable
RUN chmod +x /app/server
# Expose the port
EXPOSE 3000