FROM hasufell/alpine-haskell:3.16 AS build

RUN cabal update

COPY . /app/

WORKDIR /app

RUN cabal update
RUN cabal build exe:fediserve --enable-executable-static
RUN strip `cabal list-bin fediserve`

FROM scratch AS artifact
COPY --from=build /app/dist-newstyle/build/x86_64-linux/*/*/x/*/build/*/fediserve .