Deckgpt / Dockerfile
nexusbert's picture
push
86b5a56
# Base Image
FROM python:3.10-slim
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /code
# System Dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
libopenblas-dev \
libomp-dev \
ffmpeg \
poppler-utils \
tesseract-ocr \
tesseract-ocr-eng \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Hugging Face + model tools
RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate
# Hugging Face cache environment
ENV HF_HOME=/models/huggingface \
TRANSFORMERS_CACHE=/models/huggingface \
HUGGINGFACE_HUB_CACHE=/models/huggingface \
HF_HUB_CACHE=/models/huggingface
# Create cache dir and set permissions
RUN mkdir -p /models/huggingface && \
chown -R 1000:1000 /models/huggingface && \
chmod -R 755 /models/huggingface
# Create EasyOCR directory
RUN mkdir -p ~/.EasyOCR && \
chmod 777 ~/.EasyOCR
# Pre-download the model during build
RUN python -c "from transformers import pipeline; import torch; pipe = pipeline('text-generation', model='tiiuae/Falcon3-3B-Instruct', dtype=torch.bfloat16, device_map='cpu', model_kwargs={'low_cpu_mem_usage': False})" && \
chown -R 1000:1000 /models/huggingface && \
chmod -R 755 /models/huggingface || true
# Copy project files
COPY . .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]