1- # STAGE 1
1+ # #################################################
2+ # ################### STAGE 1 #####################
3+ # #################################################
24FROM rust:1-bookworm AS builder
35
46WORKDIR /app
@@ -14,13 +16,25 @@ RUN apt-get update && apt-get install -y \
1416 && rm -rf /var/lib/apt/lists/*
1517
1618COPY Cargo.toml Cargo.lock ./
17- COPY src ./src
19+ COPY nexum_cli/Cargo.toml ./nexum_cli/
20+ COPY nexum_core/Cargo.toml ./nexum_core/
21+ COPY tests/Cargo.toml ./tests/
22+
23+ RUN mkdir -p src && echo "fn main() {}" > src/main.rs
1824
1925ENV PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
2026
21- RUN cargo build --release
27+ RUN cargo build --release
28+
29+ COPY nexum_core ./nexum_core
30+ COPY nexum_cli ./nexum_cli
31+ COPY tests ./tests
2232
23- # STAGE 2
33+ RUN touch src/main.rs && cargo build --release
34+
35+ # #################################################
36+ # ################### STAGE 2 #####################
37+ # #################################################
2438FROM debian:bookworm-slim
2539
2640RUN apt-get update && apt-get install -y \
@@ -34,19 +48,18 @@ RUN apt-get update && apt-get install -y \
3448WORKDIR /app
3549
3650COPY --from=builder /app/target/release/nexum /usr/local/bin/nexum
37-
3851COPY nexum_ai ./nexum_ai
3952
53+ RUN useradd --system --create-home --home-dir /app --shell /bin/bash nexumuser && \
54+ chown -R nexumuser:nexumuser /app
55+
56+ USER nexumuser
57+
4058RUN python3 -m venv .venv && \
4159 . .venv/bin/activate && \
4260 pip install --no-cache-dir -r nexum_ai/requirements.txt
4361
44- RUN useradd --system --create-home --home-dir /app --shell /bin/bash nexumuser && \
45- chown -R nexumuser:nexumuser /app
46-
4762ENV PATH="/app/.venv/bin:$PATH"
4863ENV VIRTUAL_ENV="/app/.venv"
4964
50- USER nexumuser
51-
5265CMD ["nexum" ]
0 commit comments