FROM golang:1.23-alpine AS build WORKDIR /src # Resolve dependencies before copying source. Do not run `go mod tidy` here. COPY go.mod go.sum ./ RUN go mod download COPY cmd ./cmd COPY internal ./internal RUN CGO_ENABLED=0 GOOS=linux go build \ -trimpath -ldflags="-s -w" \ -o /out/neuralhunt-client ./cmd/client FROM alpine:3.21 RUN adduser -D -h /home/app app \ && mkdir -p /app /identity \ && chown -R app:app /app /identity WORKDIR /app COPY --from=build /out/neuralhunt-client /app/neuralhunt-client USER app ENV HOME=/home/app VOLUME ["/identity"] ENTRYPOINT ["/app/neuralhunt-client"] CMD ["-help"]