Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +22 -0
Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
# Install Rust and dependencies
|
| 4 |
+
RUN apt update && apt install -y curl build-essential
|
| 5 |
+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
| 6 |
+
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 7 |
+
|
| 8 |
+
WORKDIR /code
|
| 9 |
+
|
| 10 |
+
# Copy app and dependencies
|
| 11 |
+
COPY app.py .
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
COPY sample_rust/ ./sample_rust/
|
| 14 |
+
|
| 15 |
+
# Install Python and Rust modules
|
| 16 |
+
RUN pip install maturin
|
| 17 |
+
RUN maturin build --release --manifest-path sample_rust/Cargo.toml
|
| 18 |
+
RUN pip install target/wheels/*.whl
|
| 19 |
+
RUN pip install -r requirements.txt
|
| 20 |
+
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
|