FROM golang:1.16.7-alpine as gobuild

RUN apk add --no-cache git

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

ADD go.mod go.sum ./
ADD libfic ./libfic/
ADD remote/scores-sync-zqds ./remote/scores-sync-zqds/

RUN go get -d -v ./remote/scores-sync-zqds
RUN go build -v -o ./scores-sync-zqds ./remote/scores-sync-zqds


FROM alpine

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
