FROM ghcr.io/fpco/stackage-server/base-build:02cdb54683a9c8feec125bbdc9aa36f9700dad17 as build-app

RUN mkdir -p /artifacts/bin
COPY . /src
RUN stack install --stack-yaml /src/stack.yaml --local-bin-path /artifacts/bin

FROM ghcr.io/fpco/stackage-server/base-run:02cdb54683a9c8feec125bbdc9aa36f9700dad17

COPY --from=build-app /src/config/ /app/config/
COPY --from=build-app /src/static/ /app/static/
COPY --from=build-app /artifacts/bin/stackage-server /usr/local/bin/stackage-server
COPY --from=build-app /artifacts/bin/stackage-server-cron /usr/local/bin/stackage-server-cron
