28 lines
751 B
Docker
28 lines
751 B
Docker
FROM golang:1.26-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-customer-service ./cmd/customer-service
|
|
|
|
FROM alpine:3.24
|
|
RUN apk add --no-cache ca-certificates \
|
|
&& adduser -D -h /home/app app \
|
|
&& mkdir -p /app /customer-data \
|
|
&& chown -R app:app /app /customer-data
|
|
WORKDIR /app
|
|
|
|
COPY --from=build /out/neuralhunt-customer-service /app/neuralhunt-customer-service
|
|
|
|
USER app
|
|
ENV CUSTOMER_SQLITE_PATH=/customer-data/customer-service.db
|
|
EXPOSE 8090 8091 8092
|
|
ENTRYPOINT ["/app/neuralhunt-customer-service"]
|