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
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m32s
This commit is contained in:
parent
20d6a8d577
commit
826723eb5b
1 changed files with 4 additions and 10 deletions
12
Dockerfile
12
Dockerfile
|
@ -15,24 +15,18 @@ COPY . .
|
||||||
# Build the frontend with Vite and compile the server to executable
|
# Build the frontend with Vite and compile the server to executable
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
# Minimal production stage using Alpine
|
# Minimal production stage using Google's distroless image (glibc-based)
|
||||||
FROM alpine:latest
|
FROM gcr.io/distroless/cc-debian12
|
||||||
|
|
||||||
# Install CA certificates for HTTPS requests and glibc compatibility
|
|
||||||
RUN apk --no-cache add ca-certificates tzdata gcompat
|
|
||||||
|
|
||||||
WORKDIR /app
|
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 --from=builder /app/dist/server /app/server
|
||||||
|
|
||||||
# Copy the built frontend assets (but ensure we don't overwrite the server executable)
|
# 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/*.html /app/dist/
|
||||||
COPY --from=builder /app/dist/assets /app/dist/assets
|
COPY --from=builder /app/dist/assets /app/dist/assets
|
||||||
|
|
||||||
# Make the server executable
|
|
||||||
RUN chmod +x /app/server
|
|
||||||
|
|
||||||
# Expose the port
|
# Expose the port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue