Skip to content

Commit d85d3f3

Browse files
author
Francisco
committed
fix(docker): add fc_parser and request_router to API image Rust build stage
1 parent 61903bd commit d85d3f3

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

docker/api/Dockerfile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# MULTI-STAGE DOCKERFILE
33
# -------------------------
44

5-
# GLOBAL DEFAULT → CPU TORCH
5+
# GLOBAL DEFAULT → CPU TORCH
66
ARG 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 ====================================================
5151
FROM python:3.11-slim-bookworm AS rust_builder
5252

5353
RUN apt-get update && \
@@ -68,8 +68,16 @@ ENV PATH="/root/.cargo/bin:${PATH}"
6868
RUN pip install --no-cache-dir maturin
6969

7070
COPY rust/delta_normalizer /build/delta_normalizer
71+
COPY rust/request_router /build/request_router
72+
COPY rust/fc_parser /build/fc_parser
73+
7174
WORKDIR /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
7381
RUN maturin build --release --strip
7482

7583

@@ -108,20 +116,19 @@ RUN pip install --force-reinstall --no-cache-dir charset-normalizer
108116
RUN 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
112120
COPY --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

116126
COPY src /app/src
117127
COPY docker/api/init_and_run_api.sh /app/init_and_run_api.sh
118128
COPY 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

126133
RUN dos2unix /app/init_and_run_api.sh && chmod +x /app/init_and_run_api.sh
127134

0 commit comments

Comments
 (0)