File size: 1,029 Bytes
6b6915c | 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 27 28 29 30 31 32 33 34 35 36 | FROM python:3.12-slim
WORKDIR /app
# Python deps (sqlite3 is stdlib — no pip package needed)
COPY site/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy pipeline and data (cache-bust on each deploy)
ARG CACHE_BUST=20260816-1527
COPY pipeline/ ./pipeline/
RUN mkdir -p ./data
# Copy site (Astro static build)
COPY site/ ./site/
# Build Astro static site if dist/ doesn't exist
# (build-essential is for better-sqlite3 native Node addon compilation)
RUN if [ ! -d site/dist ]; then \
apt-get update && \
apt-get install -y --no-install-recommends build-essential curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
cd site && npm install && npm run build && cd .. && \
apt-get remove -y build-essential nodejs && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*; \
fi
# Copy Space entry point
COPY space_app.py ./app.py
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|