Make multi-stage builds happen within the Dockerfile, eg.
FROM ubuntu:24.03 AS base
# Install dependencies from apt and setup ghcup (do not forget to get chromium browser...)
# for development...
FROM base AS dev
WORKDIR /src
RUN --mount=type=bind,source=.,dst=.,rw \
stack --no-terminal --allow-different-user build --only-dependencies
# build stage (for app)
FROM dev AS build
WORKDIR /src
RUN --mount=type=bind,source=.,dst=.,rw \
mkdir /dist && stack --no-terminal --allow-different-user install --local-bin-path /dist
# for site and spa
FROM alpine:latest AS apps
WORKDIR /app
RUN apk update && apk upgrade --no-cache && apk add --no-cache gmp-dev libffi-dev zlib-dev chromium
COPY --from=build /dist/site /app/site
COPY --from=build /dist/spa /app/spa
ENV PATH /app:$PATH
EXPOSE 8888
Make multi-stage builds happen within the
Dockerfile
, eg.docker-compose.yml
, eg.