FROM golang:1.21.4 as build

LABEL author="Victor Lacasse-Beaudoin <vlbeaudoin@agecem.org>"
LABEL license="MIT"
LABEL licensee="AGECEM"
LABEL repo="https://git.agecem.com/agecem/babillard"

WORKDIR /go/src/app

COPY go.mod go.sum main.go ./

ADD cmd/ cmd/

ADD data/ data/

ADD handlers/ handlers/

ADD public/ public/

RUN CGO_ENABLED=0 go build -a -o babillard .

# Alpine

FROM alpine:3.18.4

RUN apk update && apk upgrade --no-cache

WORKDIR /app

ADD contenu/ contenu/

COPY --from=build /go/src/app/babillard /usr/bin/babillard

CMD ["babillard", "server"]