Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +10 -10
Dockerfile
CHANGED
|
@@ -2,7 +2,8 @@
|
|
| 2 |
FROM python:3.9.13
|
| 3 |
|
| 4 |
# Install system dependencies (including FFmpeg)
|
| 5 |
-
RUN apt-get update && apt-get install -y ffmpeg
|
|
|
|
| 6 |
|
| 7 |
# Create a new user with a specific UID and home directory
|
| 8 |
RUN useradd -m -u 1000 user
|
|
@@ -11,22 +12,21 @@ RUN useradd -m -u 1000 user
|
|
| 11 |
USER user
|
| 12 |
|
| 13 |
# Update the PATH environment variable
|
| 14 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 15 |
|
| 16 |
# Set the working directory
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
# Copy the requirements file into the container
|
| 20 |
-
COPY --chown=user ./requirements.txt requirements.txt
|
| 21 |
-
|
| 22 |
-
# Install
|
| 23 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
| 24 |
|
| 25 |
# Copy the current directory contents into the container at /app
|
| 26 |
COPY --chown=user . /app
|
| 27 |
|
| 28 |
-
# Install Gunicorn (instead of Uvicorn)
|
| 29 |
-
RUN pip install --user gunicorn
|
| 30 |
-
|
| 31 |
# Command to run the application using Gunicorn
|
| 32 |
-
|
|
|
|
|
|
| 2 |
FROM python:3.9.13
|
| 3 |
|
| 4 |
# Install system dependencies (including FFmpeg)
|
| 5 |
+
RUN apt-get update && apt-get install -y ffmpeg && \
|
| 6 |
+
rm -rf /var/lib/apt/lists/* # Clean up to reduce image size
|
| 7 |
|
| 8 |
# Create a new user with a specific UID and home directory
|
| 9 |
RUN useradd -m -u 1000 user
|
|
|
|
| 12 |
USER user
|
| 13 |
|
| 14 |
# Update the PATH environment variable
|
| 15 |
+
ENV PATH="/home/user/.local/bin:${PATH}"
|
| 16 |
|
| 17 |
# Set the working directory
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
# Copy the requirements file into the container
|
| 21 |
+
COPY --chown=user ./requirements.txt /app/requirements.txt
|
| 22 |
+
|
| 23 |
+
# Install Python dependencies
|
| 24 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt && \
|
| 25 |
+
pip install --no-cache-dir --user gunicorn # Install Gunicorn
|
| 26 |
|
| 27 |
# Copy the current directory contents into the container at /app
|
| 28 |
COPY --chown=user . /app
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
# Command to run the application using Gunicorn
|
| 31 |
+
# Set a higher timeout (e.g., 300 seconds) to handle long-running tasks
|
| 32 |
+
ENTRYPOINT ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "300", "app:app"]
|