Spaces:
Running
Running
File size: 1,631 Bytes
542c765 fc2e6dd 542c765 6c11af5 542c765 6c11af5 | 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # ββ Stage 1: Build Next.js frontend ββββββββββββββββββββββββββ
FROM node:20-slim AS frontend-builder
WORKDIR /build/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
ENV NEXT_PUBLIC_API_URL=""
RUN npm run build
# ββ Stage 2: Runtime βββββββββββββββββββββββββββββββββββββββββ
FROM python:3.11-slim
# Install Node.js 20, nginx, supervisor
RUN apt-get update && apt-get install -y --no-install-recommends \
curl gnupg nginx supervisor && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ββ Backend deps ββ
COPY backend/requirements-local.txt ./backend/
RUN pip install --no-cache-dir -r backend/requirements-local.txt
# ββ Backend source ββ
COPY backend/ ./backend/
# ββ Frontend standalone build ββ
COPY --from=frontend-builder /build/frontend/.next/standalone ./frontend/
COPY --from=frontend-builder /build/frontend/.next/static ./frontend/.next/static
COPY --from=frontend-builder /build/frontend/public ./frontend/public
# ββ Config files ββ
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Remove default nginx site
RUN rm -f /etc/nginx/sites-enabled/default
# ββ Startup script (writes HF secrets to .env) ββ
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
EXPOSE 7860
CMD ["/app/start.sh"]
|