Skip to content
Merged

Dev #29

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]