Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +27 -15
Dockerfile
CHANGED
@@ -1,22 +1,34 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
COPY requirements.txt .
|
9 |
|
10 |
-
|
11 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
|
19 |
-
|
20 |
|
21 |
-
#
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use Python 3.10 for compatibility with newer packages
|
2 |
+
FROM python:3.10
|
3 |
|
4 |
+
# Install required system dependencies
|
5 |
+
RUN apt-get update && apt-get install -y \
|
6 |
+
libgl1-mesa-glx \
|
7 |
+
libglib2.0-0
|
8 |
|
9 |
+
RUN useradd user
|
|
|
10 |
|
11 |
+
USER user
|
|
|
12 |
|
13 |
+
ENV HOME=/home/user \
|
14 |
+
PATH=/home/user/.local/bin:$PATH
|
15 |
|
16 |
+
# Set up a working directory
|
17 |
+
WORKDIR $HOME/app
|
18 |
|
19 |
+
COPY --chown=user ./ $HOME/app
|
20 |
|
21 |
+
# Install dependencies from the requirements file
|
22 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
23 |
+
|
24 |
+
# Install PyTorch and torchvision
|
25 |
+
RUN pip install torch torchvision
|
26 |
+
|
27 |
+
# Set environment variable to indicate PyTorch usage
|
28 |
+
ENV USE_TORCH=1
|
29 |
+
|
30 |
+
# Expose port 7860 for the app
|
31 |
+
EXPOSE 1326
|
32 |
+
|
33 |
+
# Command to run FastAPI app with Uvicorn
|
34 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "1326"]
|