FROM golang:1.23.4-alpine3.21 AS build-stage

WORKDIR /usr/src/app

COPY ./go.mod ./go.sum ./
RUN [ "go", "mod", "download" ]

COPY *.go ./
RUN [ "go", "build", "." ]

FROM alpine:3.14 AS prod-stage

WORKDIR /app

COPY --from=build-stage /usr/src/app/binaryimage .
COPY ./static/ ./static/
COPY ./views/ ./views/

EXPOSE 3000

ENTRYPOINT [ "./binaryimage" ]