RajatMalviya commited on
Commit
bea810c
·
verified ·
1 Parent(s): 2600fd1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -11
Dockerfile CHANGED
@@ -1,17 +1,34 @@
1
- FROM python:3.10
2
 
3
- WORKDIR /code
4
 
5
- COPY requirements.txt /code/requirements.txt
6
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
 
7
 
8
- COPY . /code
 
9
 
10
- # Create a directory for apps data with appropriate permissions
11
- RUN mkdir -p /data/apps && chmod 777 /data/apps
 
 
 
 
 
 
 
12
 
13
- ENV PYTHONPATH="/code"
14
- ENV HF_HOME="/data/apps/hf_home"
15
- ENV TRANSFORMERS_CACHE="/data/apps/transformers_cache"
16
 
17
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
 
3
+ WORKDIR /app
4
 
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ git \
9
+ && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Install PyTorch with CUDA support
12
+ RUN pip install --no-cache-dir torch==2.1.0 torchvision==0.16.0 --extra-index-url https://download.pytorch.org/whl/cu118
13
 
14
+ # Install FastAPI and other dependencies
15
+ RUN pip install --no-cache-dir fastapi==0.104.1 \
16
+ uvicorn==0.23.2 \
17
+ python-multipart==0.0.6 \
18
+ pillow==10.0.1 \
19
+ safetensors==0.4.0 \
20
+ transformers==4.34.0 \
21
+ diffusers==0.23.0 \
22
+ accelerate==0.23.0
23
 
24
+ # Copy application code
25
+ COPY . .
 
26
 
27
+ # Create model directory
28
+ RUN mkdir -p models
29
+
30
+ # Expose the port the app will run on
31
+ EXPOSE 7860
32
+
33
+ # Start the FastAPI application
34
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]