File size: 684 Bytes
5efb178
 
 
928b9ca
 
 
5efb178
 
 
 
 
 
 
b4e1d1e
 
928b9ca
3f80cab
b4e1d1e
3f80cab
 
928b9ca
5efb178
 
 
 
928b9ca
 
 
 
5efb178
 
928b9ca
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
# Use an official Python image as a base
FROM python:3.12-slim

# Create a new user
RUN useradd -m user

# Set the working directory inside the container
WORKDIR /app

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

RUN  mkdir /.cache

# Change ownership of the application directory to the new user
RUN chown -R user:user /.cache

RUN chown -R user:user /app


# Copy the rest of the application code
COPY . .

# Expose port 8000 for the FastAPI app
EXPOSE 7860

# Switch to the new user
USER user

# Run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]