Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -8
Dockerfile
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
#
|
2 |
FROM python:3.10
|
3 |
|
4 |
-
#
|
5 |
USER root
|
6 |
|
7 |
-
#
|
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 |
-
#
|
15 |
-
RUN pip install fastapi[all] uvicorn
|
16 |
|
17 |
-
#
|
18 |
COPY main.py main.py
|
19 |
|
20 |
-
#
|
21 |
RUN python main.py
|
22 |
|
23 |
-
#
|
24 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Use an appropriate base image (you can adjust this as per your requirements)
|
2 |
FROM python:3.10
|
3 |
|
4 |
+
# Switch to root user
|
5 |
USER root
|
6 |
|
7 |
+
# Install system 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 |
+
# Install Python dependencies
|
15 |
+
RUN pip install fastapi[all] uvicorn Pillow
|
16 |
|
17 |
+
# Copy the application code
|
18 |
COPY main.py main.py
|
19 |
|
20 |
+
# Run Python script to check for errors before starting FastAPI
|
21 |
RUN python main.py
|
22 |
|
23 |
+
# Start FastAPI server
|
24 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|