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