File size: 572 Bytes
14577ec df724f2 14577ec df724f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | FROM python:3.11-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ARG GEMINI_API_KEY=""
ENV GEMINI_API_KEY=${GEMINI_API_KEY}
ENV GOOGLE_API_KEY=${GEMINI_API_KEY}
# Install deps first (layer-cached)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Initialise the database at build time
RUN python -m scripts.init_db
# HF Spaces exposes port 7860
EXPOSE 7860
CMD ["bash", "-lc", "if [ -z \"$GOOGLE_API_KEY\" ] && [ -n \"$GEMINI_API_KEY\" ]; then export GOOGLE_API_KEY=\"$GEMINI_API_KEY\"; fi; uvicorn main:app --host 0.0.0.0 --port 7860"]
|