Spaces:
Sleeping
Sleeping
Commit ·
fba31c1
1
Parent(s): 2e9afea
Fix requirements path in root Dockerfile
Browse files- Dockerfile +13 -15
Dockerfile
CHANGED
|
@@ -1,36 +1,34 @@
|
|
| 1 |
-
# Use Python 3.10 slim as base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Set environment variables
|
| 8 |
-
# Prevent Python from writing .pyc files to disk
|
| 9 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 10 |
-
# Prevent Python from buffering stdout/stderr
|
| 11 |
ENV PYTHONUNBUFFERED=1
|
| 12 |
-
# Set Hugging Face cache directory to a path inside /app
|
| 13 |
ENV HF_HOME=/app/.cache/huggingface
|
| 14 |
|
| 15 |
-
# Install system
|
| 16 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 17 |
build-essential \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
# Copy requirements
|
| 21 |
-
COPY requirements.txt /app/
|
| 22 |
|
| 23 |
-
# Install
|
| 24 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
# Pre-download and cache the SentenceTransformer model during build time
|
| 27 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-large-en-v1.5')"
|
| 28 |
|
| 29 |
-
# Copy the
|
| 30 |
COPY . /app/
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# Set environment variables
|
|
|
|
| 6 |
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
| 7 |
ENV PYTHONUNBUFFERED=1
|
|
|
|
| 8 |
ENV HF_HOME=/app/.cache/huggingface
|
| 9 |
|
| 10 |
+
# Install system packages required for compiling libraries (like chromadb)
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
build-essential \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# Copy requirements.txt from the server/ subdirectory (Crucial difference!)
|
| 16 |
+
COPY server/requirements.txt /app/server/
|
| 17 |
|
| 18 |
+
# Install Python dependencies
|
| 19 |
+
RUN pip install --no-cache-dir -r /app/server/requirements.txt
|
| 20 |
|
| 21 |
# Pre-download and cache the SentenceTransformer model during build time
|
| 22 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-large-en-v1.5')"
|
| 23 |
|
| 24 |
+
# Copy the entire project (both client/ and server/)
|
| 25 |
COPY . /app/
|
| 26 |
|
| 27 |
+
# Change working directory to server where main.py resides
|
| 28 |
+
WORKDIR /app/server
|
| 29 |
|
| 30 |
+
# Expose Hugging Face Spaces default port
|
| 31 |
+
EXPOSE 7860
|
| 32 |
+
|
| 33 |
+
# Run FastAPI using uvicorn on port 7860
|
| 34 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|