Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -0
Dockerfile
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
FROM python:3.11-slim
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
# 1. First create user and directory structure
|
4 |
RUN useradd -m appuser && \
|
5 |
mkdir -p /app/data && \
|
@@ -25,6 +32,13 @@ USER appuser
|
|
25 |
COPY --chown=appuser:appuser requirements.txt .
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# 6. Copy all application files
|
29 |
COPY --chown=appuser:appuser app.py image_fetcher.py video.py video2.py ./
|
30 |
|
|
|
1 |
FROM python:3.11-slim
|
2 |
|
3 |
+
# Install Rust and maturin
|
4 |
+
USER root
|
5 |
+
RUN apt-get update && apt-get install -y curl build-essential pkg-config libssl-dev \
|
6 |
+
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \
|
7 |
+
&& . "$HOME/.cargo/env" \
|
8 |
+
&& pip install maturin
|
9 |
+
|
10 |
# 1. First create user and directory structure
|
11 |
RUN useradd -m appuser && \
|
12 |
mkdir -p /app/data && \
|
|
|
32 |
COPY --chown=appuser:appuser requirements.txt .
|
33 |
RUN pip install --no-cache-dir -r requirements.txt
|
34 |
|
35 |
+
# Copy and build the Rust module using maturin
|
36 |
+
COPY --chown=appuser:appuser rust_highlight /app/rust_highlight
|
37 |
+
WORKDIR /app/rust_highlight
|
38 |
+
|
39 |
+
# Compile and install Rust module into Python environment
|
40 |
+
RUN . "$HOME/.cargo/env" && maturin develop --release
|
41 |
+
|
42 |
# 6. Copy all application files
|
43 |
COPY --chown=appuser:appuser app.py image_fetcher.py video.py video2.py ./
|
44 |
|