Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +34 -17
Dockerfile
CHANGED
|
@@ -1,17 +1,34 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM python:3.
|
| 3 |
-
|
| 4 |
-
# Set the working directory in the container
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies needed for some Python packages
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
build-essential \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Copy the requirements file first to leverage Docker cache
|
| 13 |
+
# (Ensure your file is named requirements.txt on Hugging Face)
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
|
| 16 |
+
# Install the necessary libraries
|
| 17 |
+
# We include 'openenv' specifically to fix the ModuleNotFoundError
|
| 18 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 19 |
+
pip install --no-cache-dir \
|
| 20 |
+
fastapi \
|
| 21 |
+
uvicorn \
|
| 22 |
+
pydantic \
|
| 23 |
+
openai \
|
| 24 |
+
openenv
|
| 25 |
+
|
| 26 |
+
# Copy the rest of your application code
|
| 27 |
+
COPY . .
|
| 28 |
+
|
| 29 |
+
# Expose port 8000 (standard for FastAPI/OpenEnv)
|
| 30 |
+
EXPOSE 8000
|
| 31 |
+
|
| 32 |
+
# Command to run the OpenEnv server
|
| 33 |
+
# This points to your 'env' file and the 'app' instance inside it
|
| 34 |
+
CMD ["uvicorn", "env:app", "--host", "0.0.0.0", "--port", "8000"]
|