mirror of
https://github.com/NVIDIA/dgx-spark-playbooks.git
synced 2026-04-23 10:33:51 +00:00
23 lines
647 B
Docker
23 lines
647 B
Docker
FROM python:3.9-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install dependencies first for better caching
|
|
COPY requirements.txt /app/
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY app.py /app/
|
|
|
|
# Set default model name
|
|
ENV MODEL_NAME="all-MiniLM-L6-v2"
|
|
ENV TRANSFORMERS_CACHE="/app/.cache"
|
|
|
|
# Pre-download the model during build for faster startup
|
|
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('${MODEL_NAME}')"
|
|
|
|
# Expose the port
|
|
EXPOSE 80
|
|
|
|
# Use Gunicorn for better performance
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:80", "--workers", "1", "--threads", "8", "app:app"] |