Create Dockerfile
Browse files- Dockerfile +31 -0
Dockerfile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9-slim-buster
|
| 2 |
+
|
| 3 |
+
# Set environment variables
|
| 4 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
+
HF_HOME="/tmp/hf_cache" \
|
| 6 |
+
TRANSFORMERS_CACHE="/tmp/hf_cache/transformers" \
|
| 7 |
+
HF_DATASETS_CACHE="/tmp/hf_cache/datasets" \
|
| 8 |
+
SENTENCE_TRANSFORMERS_HOME="/tmp/hf_cache/sentence_transformers"
|
| 9 |
+
|
| 10 |
+
# Create app directory
|
| 11 |
+
WORKDIR /app
|
| 12 |
+
|
| 13 |
+
# Install system dependencies for llama-cpp-python (if needed, often included in base image)
|
| 14 |
+
# RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
+
# build-essential \
|
| 16 |
+
# cmake \
|
| 17 |
+
# libopenblas-dev \
|
| 18 |
+
# && rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
# Copy requirements file and install Python dependencies
|
| 21 |
+
COPY requirements.txt .
|
| 22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
+
|
| 24 |
+
# Copy application code
|
| 25 |
+
COPY . .
|
| 26 |
+
|
| 27 |
+
# Expose the port FastAPI will run on
|
| 28 |
+
EXPOSE 7860
|
| 29 |
+
|
| 30 |
+
# Command to run the application
|
| 31 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|