37 lines
871 B
Docker
37 lines
871 B
Docker
# Stage 1: Build Svelte frontend
|
|
FROM node:20-alpine AS frontend-builder
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm install
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Python runtime backend
|
|
FROM python:3.10-slim AS backend-runner
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
# Install python packages
|
|
COPY backend/requirements.txt ./
|
|
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
|
|
|
# Copy built static frontend
|
|
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
|
|
|
|
# Copy Python backend
|
|
COPY backend/ ./backend
|
|
|
|
# Directory setups for mounts
|
|
ENV DB_DIR=/app/data
|
|
ENV COOKIES_PATH=/app/config/cookies.txt
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["python", "backend/main.py"]
|