FROM golang:1.22-alpine AS build
WORKDIR /src
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY main.go ./
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/asn-header-service

FROM alpine:3.20
RUN apk add --no-cache wget
RUN adduser -D -H -u 10001 app
USER 10001
WORKDIR /app
COPY --from=build /out/asn-header-service /app/asn-header-service
EXPOSE 8080
ENV ADDR=:8080
ENTRYPOINT ["/app/asn-header-service"]
