Naveedtechlab's picture
feat: deploy β€” email/password only auth, no OAuth buttons
1dedc23
# ============================================================================
# HuggingFace Spaces β€” FastAPI backend (8000) + Next.js standalone (7860)
# Frontend built inside Docker so source changes always deploy correctly
# ============================================================================
FROM python:3.11-slim
# Install Node.js 18 + supervisor
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates xz-utils supervisor \
&& curl -fsSL "https://nodejs.org/dist/v18.20.4/node-v18.20.4-linux-x64.tar.xz" \
| tar -xJ -C /usr/local --strip-components=1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ── Python backend ──────────────────────────────────────────────────────────
COPY phase-1-core-infra/backend/requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
COPY phase-1-core-infra/backend/ ./backend/
# ── Next.js frontend β€” build from source ───────────────────────────────────
COPY phase-1-core-infra/frontend/package.json phase-1-core-infra/frontend/package-lock.json /build/frontend/
RUN cd /build/frontend && npm ci --legacy-peer-deps
COPY phase-1-core-infra/frontend/ /build/frontend/
RUN cd /build/frontend \
&& NEXT_PUBLIC_API_URL=http://localhost:8000 \
NEXT_TELEMETRY_DISABLED=1 \
npm run build
# Copy standalone output into /app/frontend
RUN cp -r /build/frontend/.next/standalone/. /app/frontend/ \
&& cp -r /build/frontend/.next/static/. /app/frontend/.next/static/ \
&& rm -rf /build
# ── Runtime setup ───────────────────────────────────────────────────────────
RUN mkdir -p /var/log/supervisor /app/backend/uploads
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN useradd -m -u 1000 appuser \
&& chown -R appuser:appuser /app /var/log/supervisor
EXPOSE 7860
ENV PYTHONUNBUFFERED=1 \
NODE_ENV=production \
PORT=7860 \
HOSTNAME=0.0.0.0 \
NEXT_PUBLIC_API_URL=http://localhost:8000 \
NEXT_TELEMETRY_DISABLED=1
HEALTHCHECK --interval=30s --timeout=15s --start-period=120s --retries=3 \
CMD curl -f http://localhost:7860 || exit 1
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]