22# MULTI-STAGE DOCKERFILE
33# -------------------------
44
5- # ⭐ GLOBAL DEFAULT → CPU TORCH
5+ # GLOBAL DEFAULT → CPU TORCH
66ARG TORCH_CHANNEL=cpu
77
88
@@ -47,7 +47,7 @@ RUN pip install \
4747 -r api_reqs_hashed.txt
4848
4949
50- # === Stage R: build Rust extension (delta_normalizer_rs) ===============================
50+ # === Stage R: build Rust extensions ===================== ===============================
5151FROM python:3.11-slim-bookworm AS rust_builder
5252
5353RUN apt-get update && \
@@ -68,8 +68,16 @@ ENV PATH="/root/.cargo/bin:${PATH}"
6868RUN pip install --no-cache-dir maturin
6969
7070COPY rust/delta_normalizer /build/delta_normalizer
71+ COPY rust/request_router /build/request_router
72+ COPY rust/fc_parser /build/fc_parser
73+
7174WORKDIR /build/delta_normalizer
75+ RUN maturin build --release --strip
76+
77+ WORKDIR /build/request_router
78+ RUN maturin build --release --strip
7279
80+ WORKDIR /build/fc_parser
7381RUN maturin build --release --strip
7482
7583
@@ -108,20 +116,19 @@ RUN pip install --force-reinstall --no-cache-dir charset-normalizer
108116RUN pip install --no-cache-dir html2text playwright && \
109117 playwright install --with-deps chromium
110118
111- # Install the Rust-compiled delta_normalizer_rs extension
119+ # Install all Rust-compiled extensions
112120COPY --from=rust_builder /build/delta_normalizer/target/wheels/ /tmp/rs_wheels/
113- RUN pip install --no-cache-dir /tmp/rs_wheels/delta_normalizer_rs*.whl && \
121+ COPY --from=rust_builder /build/request_router/target/wheels/ /tmp/rs_wheels/
122+ COPY --from=rust_builder /build/fc_parser/target/wheels/ /tmp/rs_wheels/
123+ RUN pip install --no-cache-dir /tmp/rs_wheels/*.whl && \
114124 rm -rf /tmp/rs_wheels
115125
116126COPY src /app/src
117127COPY docker/api/init_and_run_api.sh /app/init_and_run_api.sh
118128COPY docker/api/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
119129
120- COPY src /app/src
121- COPY alembic.ini /app/alembic.ini
122- COPY migrations /app/migrations
123- COPY docker/api/init_and_run_api.sh /app/init_and_run_api.sh
124- COPY docker/api/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
130+ COPY alembic.ini /app/alembic.ini
131+ COPY migrations /app/migrations
125132
126133RUN dos2unix /app/init_and_run_api.sh && chmod +x /app/init_and_run_api.sh
127134
0 commit comments