FROM golang:1-alpine as gobuild

RUN apk add --no-cache git

WORKDIR /go/src/srs.epita.fr/fic-server/

COPY go.mod go.sum ./
COPY libfic ./libfic/
COPY settings ./settings/
COPY remote/scores-sync-zqds ./remote/scores-sync-zqds/

RUN go get -d -v ./remote/scores-sync-zqds && \
    go build -v -buildvcs=false -o ./scores-sync-zqds ./remote/scores-sync-zqds


FROM alpine:3.20

RUN apk add --no-cache openssl ca-certificates

WORKDIR /srv

ENTRYPOINT ["/srv/scores-sync-zqds"]

COPY --from=gobuild /go/src/srs.epita.fr/fic-server/scores-sync-zqds /srv/scores-sync-zqds
