FROM golang:alpine AS GO_BUILD
LABEL authors="Damian"
COPY ./ /server
WORKDIR /server
ADD go.mod .
ADD go.sum .
RUN go mod download
RUN go install github.com/cosmtrek/air@latest
RUN go build -o /go/bin/server


FROM alpine:3.15
WORKDIR app
COPY --from=GO_BUILD /go/bin/server ./
COPY ./ .
COPY .env ./
COPY ./templates ./templates/
COPY ./assets ./assets/
CMD ./server