Spaces:
Runtime error
Runtime error
Fix: Create and set permissions for converted_audio directory in Dockerfile
Browse files- Dockerfile +4 -10
Dockerfile
CHANGED
|
@@ -5,8 +5,6 @@ FROM python:3.11-slim-buster
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Install ffmpeg which is required by pydub
|
| 8 |
-
# Use 'apt-get update' and 'apt-get install' for Debian-based images
|
| 9 |
-
# Add rm -rf /var/lib/apt/lists/* to clean up apt cache and reduce image size
|
| 10 |
RUN apt-get update && \
|
| 11 |
apt-get install -y ffmpeg && \
|
| 12 |
rm -rf /var/lib/apt/lists/*
|
|
@@ -17,14 +15,11 @@ COPY requirements.txt .
|
|
| 17 |
# Install any needed packages specified in requirements.txt
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
-
# ---
|
| 21 |
-
# Create the uploads directory and set permissions
|
| 22 |
-
# The default user in python:3.11-slim-buster is root, which has full permissions.
|
| 23 |
-
# This makes it explicit and prepares for potential user switching.
|
| 24 |
RUN mkdir -p uploads && chmod 777 uploads
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
# For now, 777 is fine to confirm it works.
|
| 28 |
# ------------------------------------------------------------------
|
| 29 |
|
| 30 |
# Copy the rest of the application code into the working directory
|
|
@@ -34,5 +29,4 @@ COPY . .
|
|
| 34 |
EXPOSE 8000
|
| 35 |
|
| 36 |
# Command to run the application
|
| 37 |
-
# Use gunicorn with uvicorn workers for production-ready deployment (optional, your current CMD is fine for simple FastAPI)
|
| 38 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Install ffmpeg which is required by pydub
|
|
|
|
|
|
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y ffmpeg && \
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
|
|
|
| 15 |
# Install any needed packages specified in requirements.txt
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# --- ADDED/UPDATED LINES TO CREATE AND PERMIT BOTH DIRECTORIES ---
|
| 19 |
+
# Create the uploads directory and set permissions
|
|
|
|
|
|
|
| 20 |
RUN mkdir -p uploads && chmod 777 uploads
|
| 21 |
+
# Create the converted_audio_temp directory and set permissions
|
| 22 |
+
RUN mkdir -p converted_audio_temp && chmod 777 converted_audio_temp
|
|
|
|
| 23 |
# ------------------------------------------------------------------
|
| 24 |
|
| 25 |
# Copy the rest of the application code into the working directory
|
|
|
|
| 29 |
EXPOSE 8000
|
| 30 |
|
| 31 |
# Command to run the application
|
|
|
|
| 32 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|