Spaces:
Runtime error
Runtime error
update docker
Browse files- backend/Dockerfile +7 -12
backend/Dockerfile
CHANGED
|
@@ -2,23 +2,18 @@
|
|
| 2 |
# Use the official Python 3.11.5 image
|
| 3 |
FROM python:3.11.5
|
| 4 |
|
| 5 |
-
EXPOSE 7860
|
| 6 |
-
|
| 7 |
-
# Prevents Python from generating .pyc files and turns off buffering
|
| 8 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
| 9 |
-
ENV PYTHONUNBUFFERED=1
|
| 10 |
-
|
| 11 |
# Set the working directory inside the container
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
-
# Copy
|
| 15 |
COPY requirements.txt .
|
|
|
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
|
| 23 |
-
# Run
|
| 24 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
|
|
|
|
| 2 |
# Use the official Python 3.11.5 image
|
| 3 |
FROM python:3.11.5
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Set the working directory inside the container
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Copy requirements and install dependencies
|
| 9 |
COPY requirements.txt .
|
| 10 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
+
# Copy the backend code into the container
|
| 13 |
+
COPY . /app
|
| 14 |
|
| 15 |
+
# Expose port 7860 for FastAPI
|
| 16 |
+
EXPOSE 7860
|
| 17 |
|
| 18 |
+
# Run FastAPI using Uvicorn
|
| 19 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
|