FROM golang:1.25-alpine AS build

WORKDIR /src
ENV GOPRIVATE=gitea.estateliga.work
RUN apk add --no-cache git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /files-service ./cmd/server

FROM gcr.io/distroless/static-debian12
COPY --from=build /files-service /files-service
COPY migrations /migrations
EXPOSE 3001
ENTRYPOINT ["/files-service"]

