ogflash commited on
Commit
b04faf8
·
1 Parent(s): b081b3e

Fix: Create and set permissions for converted_audio directory in Dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +20 -12
  2. requirements.txt +0 -0
Dockerfile CHANGED
@@ -1,32 +1,40 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.11-slim-buster
3
 
4
- # Set the working directory in the container
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/*
11
 
12
- # Copy the requirements file into the working directory
 
13
  COPY requirements.txt .
14
 
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
 
 
26
  COPY . .
27
 
28
- # Expose the port that FastAPI will run on
29
  EXPOSE 8000
30
 
31
- # Command to run the application
 
32
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Use an official Python runtime as a parent image, optimized for CPU
2
  FROM python:3.11-slim-buster
3
 
4
+ # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Install ffmpeg, which is required by pydub.
8
+ # We also clean up the apt cache to reduce image size.
9
  RUN apt-get update && \
10
  apt-get install -y ffmpeg && \
11
  rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy the requirements file into the working directory first
14
+ # This allows Docker to cache this layer if requirements.txt doesn't change
15
  COPY requirements.txt .
16
 
17
+ # Install all Python dependencies from requirements.txt
18
+ # --no-cache-dir reduces the size of the installed packages
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # --- Create and set appropriate permissions for all directories used by the application ---
22
+ # Your main.py creates these directories at startup, so they must exist and be writable
23
+ # by the user running the app inside the container (typically root by default in slim-buster).
24
+ # 'chmod 777' grants full read/write/execute permissions to all, ensuring no permission issues.
25
  RUN mkdir -p uploads && chmod 777 uploads
 
26
  RUN mkdir -p converted_audio_temp && chmod 777 converted_audio_temp
27
+ RUN mkdir -p transcriptions && chmod 777 transcriptions
28
+ # -----------------------------------------------------------------------------------------
29
 
30
+ # Copy the rest of your application code into the working directory
31
+ # Ensure your main.py, and any other Python files/folders, are in the same directory
32
+ # as your Dockerfile when you build.
33
  COPY . .
34
 
35
+ # Expose the port that your FastAPI application will run on
36
  EXPOSE 8000
37
 
38
+ # Command to run your FastAPI application using Uvicorn
39
+ # The application will listen on all network interfaces (0.0.0.0) on port 8000
40
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ