sohan-ai commited on
Commit
2d4c3ce
1 Parent(s): 4312891

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -15
Dockerfile CHANGED
@@ -1,26 +1,36 @@
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
- # Set the working directory in the container
5
- WORKDIR /app
6
 
7
- # Copy the requirements file into the container at /app
8
- COPY requirements.txt /app/
9
 
10
- # Install any needed packages specified in requirements.txt
11
- RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy the rest of the application into the container at /app
14
- COPY . /app
15
 
16
- # Create a cache directory for Hugging Face
17
- RUN mkdir -p /app/hf_cache
18
 
19
- # Set environment variable for Hugging Face cache
20
- ENV HF_HOME=/app/hf_cache
21
 
22
- # Expose port 7860
 
 
 
 
 
 
 
 
 
 
23
  EXPOSE 7860
24
 
25
- # Run the FastAPI application on port 7860
26
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
+ # Set working directory within the container
5
+ WORKDIR /code
6
 
7
+ # Copy requirements.txt to the working directory
8
+ COPY ./requirements.txt /code/requirements.txt
9
 
10
+ # Install Python dependencies
11
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
13
+ # Install ffmpeg
14
+ RUN apt update && apt install -y ffmpeg
15
 
16
+ # Create a non-root user
17
+ RUN useradd -m -u 1000 user
18
 
19
+ # Switch to the non-root user
20
+ USER user
21
 
22
+ # Set environment variables
23
+ ENV HOME=/home/user \
24
+ PATH=/home/user/.local/bin:$PATH
25
+
26
+ # Set working directory for the application
27
+ WORKDIR $HOME/app
28
+
29
+ # Copy the application code to the working directory
30
+ COPY --chown=user . $HOME/app
31
+
32
+ # Expose port 7860 (assuming your FastAPI app runs on this port)
33
  EXPOSE 7860
34
 
35
+ # Command to run the FastAPI application
36
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]