# golang two stage build
FROM golang:1.25 AS first-stage

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .

WORKDIR /app/cmd/emailnotifierjob
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main
RUN ls

FROM alpine:latest AS second-stage

WORKDIR /app
COPY --from=first-stage /app/cmd/emailnotifierjob .
RUN echo "copied over binary to production stage"
CMD ["./main"]
