foxy-dev-team/Dockerfile

63 lines
2.6 KiB
Docker

# ═══════════════════════════════════════════════════════════════════════════════
# 🦊 Foxy Dev Team — Dockerfile (Multi-stage)
# ═══════════════════════════════════════════════════════════════════════════════
# Builds both the backend (Python/FastAPI) and frontend (React/Vite)
# into a single production-ready image.
#
# Build: docker build -t foxy-dev-team .
# Run: docker run -p 7000:7000 --env-file backend/.env foxy-dev-team
# ═══════════════════════════════════════════════════════════════════════════════
# ─── Stage 1: Frontend Build ──────────────────────────────────────────────────
FROM node:22-alpine AS frontend-build
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci --silent
COPY frontend/ ./
RUN npm run build
# ─── Stage 2: Backend Runtime ─────────────────────────────────────────────────
FROM python:3.12-slim AS runtime
LABEL maintainer="Bruno Charest <bruno@dracodev.net>"
LABEL description="🦊 Foxy Dev Team — Multi-Agent Orchestration System"
LABEL version="2.0.0"
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd --create-home --shell /bin/bash foxy
WORKDIR /app
RUN chown foxy:foxy /app
# Python dependencies
COPY --chown=foxy:foxy backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Backend source
COPY --chown=foxy:foxy backend/app ./app
# Frontend static files (served by FastAPI)
COPY --chown=foxy:foxy --from=frontend-build /build/dist ./static
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:7000/api/health || exit 1
# Runtime config
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
LOG_LEVEL=info
EXPOSE 7000
USER foxy
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7000"]