| |
| FROM node:20-alpine AS frontend-builder |
| WORKDIR /app/frontend |
|
|
| |
| COPY frontend/package.json frontend/package-lock.json ./ |
| RUN npm ci |
|
|
| |
| COPY frontend ./ |
| |
| ENV NEXT_TELEMETRY_DISABLED=1 |
| RUN npm run build |
|
|
| |
| FROM python:3.8-slim |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| libgl1-mesa-glx \ |
| libglib2.0-0 \ |
| curl \ |
| build-essential \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| |
| RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ |
| && apt-get install -y nodejs |
|
|
| WORKDIR /app |
|
|
| |
| COPY backend/requirements.txt ./backend/ |
| |
| |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install --no-cache-dir -r backend/requirements.txt -f https://download.pytorch.org/whl/torch_stable.html |
|
|
| |
| COPY backend ./backend |
|
|
| |
| WORKDIR /app/frontend |
| COPY --from=frontend-builder /app/frontend/.next ./.next |
| COPY --from=frontend-builder /app/frontend/public ./public |
| COPY --from=frontend-builder /app/frontend/package.json ./package.json |
| COPY --from=frontend-builder /app/frontend/package-lock.json ./package-lock.json |
| COPY --from=frontend-builder /app/frontend/node_modules ./node_modules |
| COPY --from=frontend-builder /app/frontend/next.config.mjs ./next.config.mjs |
|
|
| |
| WORKDIR /app |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| |
| |
| RUN echo "#!/bin/bash\n\ |
| # Start Flask in background\n\ |
| python backend/flask_backend.py --port 5001 --host 127.0.0.1 &\n\ |
| # Wait a bit for backend to initialize\n\ |
| sleep 5\n\ |
| # Start Next.js in foreground on port 7860\n\ |
| cd frontend && npm start -- -p 7860\n\ |
| " > start.sh && chmod +x start.sh |
|
|
| CMD ["./start.sh"] |
|
|