tecuts commited on
Commit
0fde338
·
verified ·
1 Parent(s): 8c1ec07

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Hugging Face Python base image
2
+ # This image is optimized for the platform and handles secrets and hardware
3
+ FROM huggingface/python-pytorch:1.13.1-cuda11.6.2-cudnn8-runtime-ubuntu20.04
4
+
5
+ # Set the working directory inside the container
6
+ WORKDIR /code
7
+
8
+ # Copy the packages.txt file and install system dependencies (like ffmpeg)
9
+ # The base image has scripts that automatically read this file
10
+ COPY packages.txt packages.txt
11
+ RUN apt-get update && apt-get install -y --no-install-recommends $(cat packages.txt) && \
12
+ apt-get clean && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy the requirements.txt file and install Python dependencies
15
+ COPY requirements.txt requirements.txt
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of your application code into the container
20
+ COPY . /code
21
+
22
+ # Expose the port the app runs on
23
+ EXPOSE 7860
24
+
25
+ # Command to run the application using uvicorn
26
+ # Hugging Face Spaces automatically sets the PORT environment variable
27
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]