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/challenge-sync-airbus ./remote/challenge-sync-airbus/

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


FROM alpine:3.20

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

WORKDIR /srv

ENTRYPOINT ["/srv/challenge-sync-airbus"]

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