Files
trading_assistant/trading_assistant_api/services/country/Dockerfile
2026-02-10 10:27:54 +08:00

20 lines
606 B
Docker

FROM golang:1.25.7-alpine3.23 AS builder
WORKDIR /workspace
RUN apk add --no-cache git
# copy monorepo workspace and modules needed for country service
COPY go.work .
COPY common ./common
COPY services/country ./services/country
# download deps and build binary
RUN cd services/country && go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/bin/country-service ./services/country
FROM alpine:3.19
RUN adduser -D -u 10002 app
USER app
COPY --from=builder /workspace/bin/country-service /usr/local/bin/country-service
EXPOSE 8081
ENTRYPOINT ["/usr/local/bin/country-service"]