36 lines
811 B
Docker
36 lines
811 B
Docker
# Build stage
|
|
FROM golang:1.23-alpine AS builder
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
# Configure Go private modules
|
|
# Disable workspace mode - each component builds independently with replace directives
|
|
ENV GOPRIVATE=git.threesix.ai/*
|
|
ENV GOWORK=off
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy shared pkg and this service only
|
|
COPY pkg/ ./pkg/
|
|
COPY services/auth-svc/ ./services/auth-svc/
|
|
|
|
# Download dependencies (populates go.sum if empty)
|
|
RUN cd pkg && go mod download
|
|
RUN cd services/auth-svc && go mod download
|
|
|
|
# Build from the service directory (uses replace directive for ../pkg)
|
|
RUN cd services/auth-svc && CGO_ENABLED=0 go build -o /auth-svc ./cmd/server
|
|
|
|
# Production stage
|
|
FROM alpine:3.19
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
WORKDIR /
|
|
|
|
COPY --from=builder /auth-svc /auth-svc
|
|
|
|
EXPOSE 8001
|
|
|
|
ENTRYPOINT ["/auth-svc"]
|