Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -20
Dockerfile
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
-
# After setting WORKDIR /app
|
| 5 |
-
RUN mkdir -p /app/images && chmod -R 777 /app/images
|
| 6 |
|
| 7 |
-
# Install system
|
| 8 |
RUN apt-get update && \
|
| 9 |
-
apt-get install -y --no-install-recommends \
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
zlib1g-dev \
|
| 17 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
-
|
| 19 |
-
# Install Python dependencies
|
| 20 |
COPY requirements.txt .
|
| 21 |
-
RUN python -m pip install --no-cache-dir -r requirements.txt
|
| 22 |
-
python -m pip list
|
| 23 |
|
| 24 |
-
# Copy application
|
| 25 |
COPY app.py text2generation.py audio_scripter.py image_scripter.py image_fetcher.py video_creater.py ./
|
| 26 |
|
| 27 |
-
#
|
|
|
|
|
|
|
|
|
|
| 28 |
EXPOSE 7860
|
| 29 |
|
| 30 |
-
#
|
| 31 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 32 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 33 |
|
| 34 |
-
#
|
| 35 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Use a minimal Python image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
# Install required system packages
|
| 8 |
RUN apt-get update && \
|
| 9 |
+
apt-get install -y --no-install-recommends gcc ffmpeg curl && \
|
| 10 |
+
rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Upgrade pip
|
| 13 |
+
RUN python -m pip install --upgrade pip
|
| 14 |
+
|
| 15 |
+
# Copy requirements and install Python dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
COPY requirements.txt .
|
| 17 |
+
RUN python -m pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 18 |
|
| 19 |
+
# Copy application code
|
| 20 |
COPY app.py text2generation.py audio_scripter.py image_scripter.py image_fetcher.py video_creater.py ./
|
| 21 |
|
| 22 |
+
# Create necessary directories with correct permissions
|
| 23 |
+
RUN mkdir -p /app/images && chmod -R 755 /app/images
|
| 24 |
+
|
| 25 |
+
# Expose the port your app runs on
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Add health check
|
| 29 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 30 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 31 |
|
| 32 |
+
# Start the application
|
| 33 |
CMD ["python", "app.py"]
|