Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -8
Dockerfile
CHANGED
|
@@ -1,29 +1,33 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install system dependencies in
|
| 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
|
| 20 |
COPY app.py image_fetcher.py video.py video2.py ./
|
| 21 |
|
| 22 |
-
# Create directories
|
| 23 |
-
RUN mkdir -p /tmp/
|
| 24 |
|
| 25 |
-
# Expose port
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
# Run
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"]
|