banao-tech commited on
Commit
f4193b9
·
verified ·
1 Parent(s): 5dee802

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
- FROM pytorch/pytorch:latest
2
-
3
 
 
4
  USER root
5
 
 
6
  RUN chmod 1777 /tmp \
7
  && apt update -q && apt install -y ca-certificates wget libgl1 \
8
  && wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
9
  && dpkg -i /tmp/cuda-keyring.deb && apt update -q \
10
  && apt install -y --no-install-recommends libcudnn8 libcublas-12-2
11
 
12
- # Install FastAPI and other Python dependencies
13
  RUN pip install fastapi[all] uvicorn
14
 
15
- # Copy application code
16
  COPY main.py main.py
17
 
18
- # Run Python script to check for errors before starting FastAPI
19
- RUN python main.py
20
 
21
- # Start FastAPI server
22
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Step 1: Use an appropriate base image
2
+ FROM python:3.10
3
 
4
+ # Step 2: Switch to root user
5
  USER root
6
 
7
+ # Step 3: Install necessary dependencies
8
  RUN chmod 1777 /tmp \
9
  && apt update -q && apt install -y ca-certificates wget libgl1 \
10
  && wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
11
  && dpkg -i /tmp/cuda-keyring.deb && apt update -q \
12
  && apt install -y --no-install-recommends libcudnn8 libcublas-12-2
13
 
14
+ # Step 4: Install FastAPI and other Python dependencies
15
  RUN pip install fastapi[all] uvicorn
16
 
17
+ # Step 5: Copy application code
18
  COPY main.py main.py
19
 
20
+ # Step 6: Run Python script to check for errors before starting FastAPI
21
+ RUN python main.py
22
 
23
+ # Step 7: Start FastAPI server
24
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]