sreepathi-ravikumar commited on
Commit
1b068d8
·
verified ·
1 Parent(s): 9637274

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -4
Dockerfile CHANGED
@@ -1,4 +1,3 @@
1
- # Dockerfile
2
  FROM python:3.11-slim
3
 
4
  # Install Rust and maturin
@@ -10,8 +9,8 @@ RUN apt-get update && apt-get install -y curl build-essential pkg-config libssl-
10
 
11
  # 1. First create user and directory structure
12
  RUN useradd -m appuser && \
13
- mkdir -p /app/data && \
14
- chown -R appuser:appuser /app
15
 
16
  # 2. Switch to appuser early
17
  USER appuser
@@ -21,6 +20,9 @@ WORKDIR /app
21
  USER root
22
  RUN apt-get update && apt-get install -y \
23
  ffmpeg \
 
 
 
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
  # 4. Switch back to appuser for Python operations
@@ -44,11 +46,25 @@ USER appuser
44
  WORKDIR /app
45
  # --- RUST BUILD END ---
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  # 6. Copy all application files
48
  COPY --chown=appuser:appuser app.py image_fetcher.py video.py video2.py ./
49
 
50
  # 7. Environment variables
51
- ENV BASE_DIR="/app/data"
52
 
53
  EXPOSE 7860
54
  CMD ["python", "app.py"]
 
 
1
  FROM python:3.11-slim
2
 
3
  # Install Rust and maturin
 
9
 
10
  # 1. First create user and directory structure
11
  RUN useradd -m appuser && \
12
+ mkdir -p /data && \
13
+ chown -R appuser:appuser /data
14
 
15
  # 2. Switch to appuser early
16
  USER appuser
 
20
  USER root
21
  RUN apt-get update && apt-get install -y \
22
  ffmpeg \
23
+ tesseract-ocr \
24
+ tesseract-ocr-tam \
25
+ fonts-liberation \
26
  && rm -rf /var/lib/apt/lists/*
27
 
28
  # 4. Switch back to appuser for Python operations
 
46
  WORKDIR /app
47
  # --- RUST BUILD END ---
48
 
49
+ # --- RUST COMBINER BUILD START ---
50
+ USER root
51
+ COPY --chown=appuser:appuser rust_combiner /app/rust_combiner
52
+ WORKDIR /app/rust_combiner
53
+
54
+ ENV PATH="/root/.cargo/bin:${PATH}"
55
+ RUN maturin build --release --manifest-path Cargo.toml
56
+ RUN pip install target/wheels/*.whl
57
+
58
+ # Go back to app setup
59
+ USER appuser
60
+ WORKDIR /app
61
+ # --- RUST COMBINER BUILD END ---
62
+
63
  # 6. Copy all application files
64
  COPY --chown=appuser:appuser app.py image_fetcher.py video.py video2.py ./
65
 
66
  # 7. Environment variables
67
+ ENV BASE_DIR="/data"
68
 
69
  EXPOSE 7860
70
  CMD ["python", "app.py"]