File size: 983 Bytes
0f62e9d
 
 
a2234fc
 
 
 
 
 
 
 
 
 
0649f1b
 
 
 
a2234fc
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Hugging Face Spaces image (the Space builds this root Dockerfile from the whole repo).
# One container, non-root uid 1000, port 7860; the worker runs inside the API process.
# Local docker-compose builds backend/Dockerfile instead.
FROM python:3.12-slim

RUN useradd -m -u 1000 user
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 \
    ENV=production \
    RUN_WORKER_IN_API=true \
    CORPUS_CACHE_DIR=/app/.corpus-cache \
    LOCAL_STORAGE_DIR=/app/.storage

# Chromium draws an infographic's PNG for its Download button (and the fonts the pages use)
RUN apt-get update && apt-get install -y --no-install-recommends chromium fonts-liberation \
    && rm -rf /var/lib/apt/lists/*

COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user backend/ .
RUN rm -f .env
USER user

EXPOSE 7860
CMD ["sh", "-c", "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 7860 --proxy-headers --forwarded-allow-ips='*'"]