@@ -12,28 +12,68 @@ COPY . /opt/build
1212
1313RUN cabal install --installdir=/opt/bin --install-method=copy
1414
15- FROM haskell:9.8.4-slim-bullseye
15+ # Pre-install dataframe package in build stage so we can copy the store
16+ RUN cabal install dataframe
17+
18+ # ---------- Runtime ----------
19+ FROM debian:bullseye-slim
1620
17- RUN apt-get update && apt-get install -y \
21+ RUN apt-get update && apt-get install -y --no-install-recommends \
1822 ca-certificates \
1923 libgmp10 \
24+ libtinfo5 \
25+ libffi-dev \
26+ python3 \
27+ python3-pip \
2028 tini \
29+ curl \
2130 && rm -rf /var/lib/apt/lists/*
2231
32+ # Install GHC + cabal via GHCup (minimal footprint, no HLS/Stack)
33+ ENV GHCUP_INSTALL_BASE_PREFIX="/opt"
34+ ENV PATH="/opt/.ghcup/bin:${PATH}"
35+ RUN curl -sSf https://get-ghcup.haskell.org | \
36+ BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
37+ BOOTSTRAP_HASKELL_GHC_VERSION=9.8.4 \
38+ BOOTSTRAP_HASKELL_CABAL_VERSION=latest \
39+ BOOTSTRAP_HASKELL_INSTALL_HLS=0 \
40+ BOOTSTRAP_HASKELL_INSTALL_STACK=0 \
41+ sh \
42+ && rm -rf /opt/.ghcup/cache /opt/.ghcup/tmp
43+
44+ # Remove curl now that GHCup is installed
45+ RUN apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
46+
47+ # Install Python ML packages (no cache, no .pyc)
48+ RUN pip3 install --no-cache-dir --no-compile numpy pandas scikit-learn polars \
49+ && find /usr/lib/python3 -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
50+
51+ # Install elan (Lean 4 toolchain manager)
52+ ENV ELAN_HOME="/root/.elan"
53+ ENV PATH="${ELAN_HOME}/bin:${PATH}"
54+ RUN apt-get update && apt-get install -y --no-install-recommends curl \
55+ && curl -sSf https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh \
56+ | sh -s -- -y --default-toolchain leanprover/lean4:v4.29.0 \
57+ && apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
58+
59+ # Verify installations
60+ RUN python3 --version && lean --version && lake --version
61+
2362WORKDIR /opt/sabela
2463
64+ # Copy compiled binary
2565COPY --from=build /opt/bin/sabela /opt/bin/sabela
2666
67+ # Copy pre-built cabal store and package index from build stage
68+ COPY --from=build /root/.cabal/store /root/.cabal/store
69+ COPY --from=build /root/.cabal/packages /root/.cabal/packages
70+
71+ # Copy static assets
2772COPY --from=build /opt/build/static/ /opt/sabela/static/
2873COPY --from=build /opt/build/display/ /opt/sabela/display/
2974
3075COPY ./examples /opt/sabela/examples/
3176
32- RUN cabal update
33-
34- RUN cabal install dataframe
35-
3677ENTRYPOINT ["/usr/bin/tini" , "--" ]
3778
38- CMD ["timeout" , "900" , "/opt/bin/sabela" , "3000" , "examples" , \
39- "/root/.sabela/global.md" , "granite" , "text" ]
79+ CMD ["/opt/bin/sabela" , "3000" , "." ]
0 commit comments