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
14
Dockerfile
14
Dockerfile
|
@ -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
|
||||
|
||||
|
@ -40,4 +34,4 @@ EXPOSE 3000
|
|||
ENV NODE_ENV=production
|
||||
|
||||
# Start the application using the compiled executable
|
||||
CMD ["/app/server"]
|
||||
CMD ["/app/server"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue