Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +21 -13
Dockerfile
CHANGED
|
@@ -1,22 +1,30 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
| 6 |
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 7 |
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
-
# Copy
|
| 11 |
-
COPY
|
| 12 |
-
COPY requirements.txt .
|
| 13 |
-
COPY sample_rust/ ./sample_rust/
|
| 14 |
|
| 15 |
-
# Install
|
| 16 |
-
RUN
|
| 17 |
-
|
| 18 |
-
|
| 19 |
RUN pip install -r requirements.txt
|
| 20 |
|
| 21 |
-
|
| 22 |
-
CMD ["
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Install system dependencies
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
curl \
|
| 8 |
+
build-essential \
|
| 9 |
+
libssl-dev \
|
| 10 |
+
pkg-config \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Install Rust using rustup
|
| 14 |
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
| 15 |
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 16 |
|
| 17 |
+
# Install maturin
|
| 18 |
+
RUN pip install maturin
|
| 19 |
|
| 20 |
+
# Copy your codebase
|
| 21 |
+
COPY . .
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
# ✅ Install the Rust module directly into Python env
|
| 24 |
+
RUN maturin develop --release --manifest-path sample_rust/Cargo.toml
|
| 25 |
+
|
| 26 |
+
# Install Python dependencies
|
| 27 |
RUN pip install -r requirements.txt
|
| 28 |
|
| 29 |
+
# Run the app
|
| 30 |
+
CMD ["python", "app.py"]
|