Files
trading_assistant/trading_assistant_api/services/user/Dockerfile
2026-02-09 16:56:10 +08:00

22 lines
609 B
Docker

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