sreepathi-ravikumar commited on
Commit
e4b04f2
·
verified ·
1 Parent(s): d36e81b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -8
Dockerfile CHANGED
@@ -1,29 +1,33 @@
1
- # Use official Python base image
2
  FROM python:3.11-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies in a single layer to reduce image size
8
  RUN apt-get update && apt-get install -y \
9
  ffmpeg \
10
- fonts-liberation \
11
  tesseract-ocr \
12
  tesseract-ocr-tam \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Copy requirements.txt and install Python packages
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy the rest of the app
20
  COPY app.py image_fetcher.py video.py video2.py ./
21
 
22
- # Create directories for video and audio with proper permissions
23
- RUN mkdir -p /tmp/video /tmp/sound && chmod -R 777 /tmp/video /tmp/sound
24
 
25
- # Expose port 7860 (as specified)
26
  EXPOSE 7860
27
 
28
- # Run the Flask app
 
 
 
 
29
  CMD ["python", "app.py"]
 
1
+ # Use a lightweight Python image
2
  FROM python:3.11-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies in one layer
8
  RUN apt-get update && apt-get install -y \
9
  ffmpeg \
 
10
  tesseract-ocr \
11
  tesseract-ocr-tam \
12
+ fonts-liberation \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Copy requirements.txt and install Python packages
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy app files
20
  COPY app.py image_fetcher.py video.py video2.py ./
21
 
22
+ # Create directories with full permissions
23
+ RUN mkdir -p /tmp/images /tmp/sound /tmp/video && chmod -R 777 /tmp/images /tmp/sound /tmp/video
24
 
25
+ # Expose port
26
  EXPOSE 7860
27
 
28
+ # Run as non-root user for safety
29
+ RUN useradd -m appuser
30
+ USER appuser
31
+
32
+ # Start the app
33
  CMD ["python", "app.py"]