| |
| |
| |
| |
| FROM python:3.11-slim |
|
|
| |
| 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 |
|
|
| |
| 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/ |
|
|
| |
| 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 |
|
|
| |
| RUN cp -r /build/frontend/.next/standalone/. /app/frontend/ \ |
| && cp -r /build/frontend/.next/static/. /app/frontend/.next/static/ \ |
| && rm -rf /build |
|
|
| |
| 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"] |
|
|