This commit is contained in:
vipg
2026-02-10 10:27:54 +08:00
parent 5da272af2e
commit 1cbd043297
3 changed files with 78 additions and 9 deletions

View File

@@ -0,0 +1,19 @@
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"]