File size: 1,078 Bytes
5d431d1
c3c3a5e
 
5d431d1
c3c3a5e
 
fda84bd
 
 
 
 
 
5d431d1
c3c3a5e
 
 
5d431d1
 
 
 
 
 
 
6d69b6d
5d431d1
c3c3a5e
 
5d431d1
 
 
 
 
 
 
c3c3a5e
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
# Use the official Python image
FROM python:3.11

# Set the working directory inside the container
WORKDIR /code

# Install ffmpeg and other dependencies
RUN apt-get update && \
    apt-get install -y ffmpeg && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Copy the requirements file and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Create the Hugging Face cache directory, set permissions, and create a non-root user
RUN mkdir -p /.cache/huggingface/hub && \
    chmod -R 777 /.cache/huggingface && \
    useradd -m nonrootuser

# Set ownership of the .cache directory to the non-root user
RUN chown -R nonrootuser:nonrootuser /.cache/huggingface

# Copy the rest of the application code
COPY . .

# Change ownership of the application code to the non-root user
RUN chown -R nonrootuser:nonrootuser /code

# Switch to the non-root user
USER nonrootuser

# Specify the command to run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]