Leon4gr45 commited on
Commit
4a15a33
·
verified ·
1 Parent(s): 0442491

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -0
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a standard base image with CUDA support
2
+ FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
3
+
4
+ # Set environment variables for caching
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV HF_HOME="/data/huggingface"
7
+ ENV UV_CACHE_DIR="/data/uv_cache"
8
+
9
+ # Install git and uv (for faster package installation)
10
+ RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
11
+ RUN pip install uv
12
+
13
+ # Copy requirements and install them efficiently
14
+ COPY requirements.txt .
15
+ RUN uv pip install --no-cache -r requirements.txt
16
+
17
+ # Copy the application code into the container
18
+ COPY ./app.py /app/app.py
19
+ WORKDIR /app
20
+
21
+ # Expose the port the app will run on
22
+ EXPOSE 7860
23
+
24
+ # THE CRITICAL COMMAND: This tells the container how to run your FastAPI app.
25
+ # The Gradio SDK cannot do this.
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]