Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -21
Dockerfile
CHANGED
|
@@ -1,35 +1,28 @@
|
|
| 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 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 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 |
-
#
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
# Install Rust + Python + maturin earlier...
|
| 24 |
-
|
| 25 |
|
|
|
|
|
|
|
| 26 |
|
|
|
|
| 27 |
RUN maturin build --release --manifest-path sample_rust/Cargo.toml
|
| 28 |
-
RUN ls -l target/wheels/ # Debug: list wheels
|
| 29 |
-
RUN pip install $(find target/wheels -name "*.whl" | head -n 1)
|
| 30 |
|
| 31 |
-
# Install
|
| 32 |
-
RUN pip install
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
CMD ["
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
|
|
|
| 3 |
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
+
curl build-essential python3-dev \
|
| 6 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
# Install Rust
|
| 9 |
+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
|
|
|
|
|
|
|
|
|
|
| 10 |
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 11 |
|
| 12 |
# Install maturin
|
| 13 |
RUN pip install maturin
|
| 14 |
|
| 15 |
+
# Set working directory
|
| 16 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# Copy your code
|
| 19 |
+
COPY . .
|
| 20 |
|
| 21 |
+
# Build the Python wheel using maturin
|
| 22 |
RUN maturin build --release --manifest-path sample_rust/Cargo.toml
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# Install the built wheel from the correct path
|
| 25 |
+
RUN pip install sample_rust/target/wheels/*.whl
|
| 26 |
|
| 27 |
+
# Default command
|
| 28 |
+
CMD ["python3"]
|