rwadurian/backend/mpc-system/services/account/Dockerfile

34 lines
675 B
Docker

# Build stage
FROM golang:1.21-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-w -s" \
-o /bin/account-service \
./services/account/cmd/server
# Final stage
FROM alpine:3.18
RUN apk --no-cache add ca-certificates wget
RUN adduser -D -s /bin/sh mpc
COPY --from=builder /bin/account-service /bin/account-service
USER mpc
EXPOSE 50051 8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget -q --spider http://localhost:8080/health || exit 1
ENTRYPOINT ["/bin/account-service"]