Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +35 -21
Dockerfile
CHANGED
|
@@ -1,21 +1,35 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight Python base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
# git is often useful for MCP tools or cloning internal libraries
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommended \
|
| 10 |
+
git \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Copy the configuration files first to leverage Docker cache
|
| 14 |
+
COPY pyproject.toml .
|
| 15 |
+
# Create a dummy README.md as it is referenced in pyproject.toml
|
| 16 |
+
RUN touch README.md
|
| 17 |
+
|
| 18 |
+
# Install the package and its dependencies
|
| 19 |
+
RUN pip install --no-cache-dir .
|
| 20 |
+
|
| 21 |
+
# Copy the source code into the container
|
| 22 |
+
COPY server/app.py .
|
| 23 |
+
COPY server/tasks.py .
|
| 24 |
+
COPY inference.py .
|
| 25 |
+
|
| 26 |
+
# Expose the port specified in your openenv.yaml
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# Ensure logs are sent straight to terminal without buffering
|
| 30 |
+
ENV PYTHONUNBUFFERED=1
|
| 31 |
+
# Set the default port for the app
|
| 32 |
+
ENV PORT=7860
|
| 33 |
+
|
| 34 |
+
# Start the FastAPI server using the main entry point defined in app.py
|
| 35 |
+
CMD ["python", "server/app.py"]
|