Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -10
Dockerfile
CHANGED
|
@@ -1,27 +1,27 @@
|
|
| 1 |
# Use the official Python 3.10.9 image
|
| 2 |
FROM python:3.10.9
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Install dependencies for OpenCV and other requirements
|
| 8 |
RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 curl
|
| 9 |
|
| 10 |
-
# Set the working directory to /
|
| 11 |
-
WORKDIR /
|
| 12 |
-
|
| 13 |
# Create a user to avoid permission issues
|
| 14 |
RUN useradd -m appuser
|
| 15 |
USER appuser
|
| 16 |
|
| 17 |
-
# Set the working directory to /home/appuser
|
| 18 |
-
WORKDIR /home/appuser
|
| 19 |
-
|
| 20 |
# Add /home/appuser/.local/bin to PATH
|
| 21 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
| 22 |
|
| 23 |
-
# Install
|
| 24 |
-
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# Start the FastAPI app
|
| 27 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# Use the official Python 3.10.9 image
|
| 2 |
FROM python:3.10.9
|
| 3 |
|
| 4 |
+
# Set the working directory to /app
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into /app inside the container
|
| 8 |
+
COPY . /app
|
| 9 |
|
| 10 |
# Install dependencies for OpenCV and other requirements
|
| 11 |
RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 curl
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
# Create a user to avoid permission issues
|
| 14 |
RUN useradd -m appuser
|
| 15 |
USER appuser
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
# Add /home/appuser/.local/bin to PATH
|
| 18 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
| 19 |
|
| 20 |
+
# Install Python dependencies
|
| 21 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
| 22 |
+
|
| 23 |
+
# Set the FastAPI app environment variable to point to the app file path
|
| 24 |
+
ENV PYTHONPATH=/app
|
| 25 |
|
| 26 |
# Start the FastAPI app
|
| 27 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|