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 settings settings/
COPY libfic ./libfic/
COPY receiver ./receiver/

RUN go get -d -v ./receiver && \
    go build -v -buildvcs=false -o ./receiver/receiver ./receiver


FROM alpine:3.20

EXPOSE 8080

WORKDIR /srv

ENTRYPOINT ["/usr/sbin/entrypoint.sh"]
CMD ["--bind=:8080"]

COPY entrypoint-receiver.sh /usr/sbin/entrypoint.sh

COPY --from=gobuild /go/src/srs.epita.fr/fic-server/receiver/receiver /srv/receiver
