File size: 1,544 Bytes
b04faf8
870cc4e
 
b04faf8
870cc4e
 
69e578b
 
 
 
b04faf8
 
1f9a83e
 
 
870cc4e
b04faf8
870cc4e
 
b04faf8
870cc4e
 
b04faf8
69e578b
1f9a83e
b081b3e
b04faf8
69e578b
b04faf8
1f9a83e
b04faf8
870cc4e
 
b04faf8
870cc4e
 
b04faf8
870cc4e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use an official Python runtime as a parent image, optimized for CPU
FROM python:3.11-slim-buster

# Set the working directory inside the container
WORKDIR /app

# --- Set Hugging Face cache directory to a writable location within the WORKDIR ---
ENV HF_HOME /app/.cache/huggingface
# ----------------------------------------------------------------------------------

# Install ffmpeg, which is required by pydub.
# We also clean up the apt cache to reduce image size.
RUN apt-get update && \
    apt-get install -y ffmpeg && \
    rm -rf /var/lib/apt/lists/*

# Copy the requirements file into the working directory first
COPY requirements.txt .

# Install all Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# --- Create and set appropriate permissions for all directories used by the application ---
# This includes the new HF_HOME path and your app-specific directories.
RUN mkdir -p uploads && chmod 777 uploads
RUN mkdir -p converted_audio_temp && chmod 777 converted_audio_temp
RUN mkdir -p transcriptions && chmod 777 transcriptions
RUN mkdir -p ${HF_HOME} && chmod 777 ${HF_HOME} # Ensure HF_HOME is created and writable
# -----------------------------------------------------------------------------------------

# Copy the rest of your application code into the working directory
COPY . .

# Expose the port that your FastAPI application will run on
EXPOSE 8000

# Command to run your FastAPI application using Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]