fix(headroom-proxy): use multi-stage build with Rust 1.87 to compile headroom._core extension

This commit is contained in:
Krrish Dholakia 2026-06-29 18:25:04 -07:00
parent 654f610693
commit 3c7daf6e6c

View file

@ -1,15 +1,22 @@
FROM python:3.12-slim
FROM rust:1.87-slim-bookworm AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& pip install --no-cache-dir "headroom-ai[proxy]==0.27.0" \
&& apt-get purge -y build-essential \
&& apt-get autoremove -y \
&& apt-get install -y --no-install-recommends python3 python3-pip python3-venv build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir "headroom-ai[proxy]==0.27.0"
FROM python:3.12-slim-bookworm
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
EXPOSE 8787
ENV HEADROOM_TELEMETRY=off
ENV HEADROOM_REQUIRE_RUST_CORE=false
CMD ["headroom", "proxy", "--host", "0.0.0.0", "--port", "8787", "--no-optimize"]