diff --git a/Dockerfile b/Dockerfile index 7d13327..e0b7ea2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,7 @@ FROM --platform=$BUILDPLATFORM golang:1.24-bookworm AS builder # Create and change to the app directory. WORKDIR /app -# Retrieve application dependencies. -# This allows the container build to reuse cached dependencies. -# Expecting to copy go.mod and if present go.sum. +# Cache deps COPY go.mod go.sum ./ RUN go mod download @@ -34,26 +32,20 @@ RUN chmod 755 /app/mpa-service # Use scratch image for smallest possible container FROM scratch -# Copy CA certificates for HTTPS requests -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ - -# Create and change to the app directory. WORKDIR /app -# Copy the binary to the production image from the builder stage. +# CA certs +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ + +# App COPY --from=builder /app/mpa-service /app/mpa-service COPY --from=builder /app/configs /app/configs -# Create non-root user (ID 1000) USER 1000 - -# Expose the default port EXPOSE 80 -# Add metadata labels LABEL maintainer="Space-DF" \ description="Multi-Protocol Agent (MPA) service" \ version="1.0" -# Run the web service on container startup. CMD ["/app/mpa-service", "serve"]