Spaces:
Sleeping
Sleeping
docker config -- port mapping
Browse files- Dockerfile +7 -3
Dockerfile
CHANGED
|
@@ -11,7 +11,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 11 |
gcc \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
COPY requirements.txt .
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
|
@@ -23,7 +27,7 @@ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTr
|
|
| 23 |
COPY app/ ./app/
|
| 24 |
|
| 25 |
# Default port 8000 for local/Docker. HF Spaces overrides with PORT=7860.
|
| 26 |
-
ENV PORT=
|
| 27 |
-
EXPOSE
|
| 28 |
|
| 29 |
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]
|
|
|
|
| 11 |
gcc \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Install CPU-only PyTorch first — avoids pulling 2.5 GB CUDA build
|
| 15 |
+
# sentence-transformers depends on torch; without this it installs the full CUDA wheel
|
| 16 |
+
RUN pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu
|
| 17 |
+
|
| 18 |
+
# Copy the requirements file and install remaining Python dependencies
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
|
|
|
| 27 |
COPY app/ ./app/
|
| 28 |
|
| 29 |
# Default port 8000 for local/Docker. HF Spaces overrides with PORT=7860.
|
| 30 |
+
ENV PORT=7860
|
| 31 |
+
EXPOSE 7860
|
| 32 |
|
| 33 |
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]
|