| FROM python:3.11-slim |
|
|
| |
| 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/* |
|
|
| |
| RUN useradd -m appuser && \ |
| mkdir -p /data && \ |
| chown -R appuser:appuser /data |
|
|
| |
| USER appuser |
| WORKDIR /app |
|
|
| |
| 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/* |
|
|
| |
| USER appuser |
|
|
| |
| COPY --chown=appuser:appuser requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| 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 |
|
|
| |
| 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 |
|
|
| |
| USER appuser |
| WORKDIR /app |
|
|
| |
| COPY --chown=appuser:appuser app.py image_fetcher.py video.py video2.py ./ |
|
|
| |
| ENV BASE_DIR="/data" |
|
|
| EXPOSE 7860 |
| CMD ["python", "app.py"] |