You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
954 B
36 lines
954 B
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
# Cache the model
|
|
RUN python -c "from gliner import GLiNER; GLiNER.from_pretrained('knowledgator/gliner-multitask-large-v0.5', save_path='/app/model')"
|
|
|
|
# Copy all project files
|
|
COPY . .
|
|
|
|
# Environment variables with defaults
|
|
ENV PORT=8000
|
|
ENV MODEL_NAME=knowledgator/gliner-multitask-large-v0.5
|
|
ENV MAX_TEXT_LENGTH=1000
|
|
|
|
# Expose port
|
|
EXPOSE ${PORT}
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
|
|
CMD python -c "import requests; requests.get('http://localhost:${PORT}/health')"
|
|
|
|
# Run the application
|
|
CMD uvicorn gliner_inference_server.main:app --host 0.0.0.0 --port ${PORT}
|