File size: 1,741 Bytes
0dc302d
84308e2
aa5fa1d
 
807c547
 
 
 
 
 
 
 
953f0bf
aa5fa1d
 
807c547
 
 
aa5fa1d
807c547
b5e16c8
1b068d8
 
b5e16c8
807c547
b5e16c8
5d86b96
9a41c54
807c547
b5e16c8
ab1c7fb
 
1b068d8
 
 
807c547
ab1c7fb
 
807c547
7a643e7
 
807c547
7a643e7
 
 
807c547
08f09fa
aa5fa1d
 
08f09fa
239dc1e
 
 
807c547
1b068d8
 
 
 
 
 
 
 
 
 
 
807c547
b5e16c8
9facb6f
807c547
1b068d8
fc6863a
ab1c7fb
0dc302d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM python:3.11-slim

# Install Rust and maturin
USER root
RUN apt-get update && apt-get install -y \
    curl \
    build-essential \
    pkg-config \
    libssl-dev \
    libopencv-dev \
    clang \
    libclang-dev \
    patchelf \
    && curl https://sh.rustup.rs -sSf | bash -s -- -y \
    && . "$HOME/.cargo/env" \
    && pip install maturin \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Create user and directory structure
RUN useradd -m appuser && \
    mkdir -p /data && \
    chown -R appuser:appuser /data

# Switch to appuser
USER appuser
WORKDIR /app

# Install system packages
USER root
RUN apt-get update && apt-get install -y \
    ffmpeg \
    tesseract-ocr \
    tesseract-ocr-tam \
    fonts-liberation \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Switch back to appuser for Python operations
USER appuser

# Install Python packages
COPY --chown=appuser:appuser requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Build rust_highlight
USER root
COPY --chown=appuser:appuser rust_highlight /app/rust_highlight
WORKDIR /app/rust_highlight
ENV PATH="/root/.cargo/bin:${PATH}"
RUN maturin build --release --manifest-path Cargo.toml
RUN pip install target/wheels/*.whl

# Build rust_combiner (if still needed)
USER root
COPY --chown=appuser:appuser rust_combiner /app/rust_combiner
WORKDIR /app/rust_combiner
ENV PATH="/root/.cargo/bin:${PATH}"
RUN maturin build --release --manifest-path Cargo.toml
RUN pip install target/wheels/*.whl

# Go back to app setup
USER appuser
WORKDIR /app

# Copy application files
COPY --chown=appuser:appuser app.py image_fetcher.py video.py video2.py ./

# Environment variables
ENV BASE_DIR="/data"

EXPOSE 7860
CMD ["python", "app.py"]