| |
| FROM node:18 as frontend-build |
| WORKDIR /app |
| COPY frontend/package*.json ./ |
| RUN npm install |
| COPY frontend/ ./ |
|
|
| RUN npm run build |
|
|
| |
| FROM python:3.12-slim |
| WORKDIR /app |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| |
| RUN pip install poetry |
|
|
| |
| RUN mkdir -p /app/.cache && \ |
| chown -R user:user /app |
|
|
| |
| COPY backend/pyproject.toml backend/poetry.lock* ./ |
| RUN poetry config virtualenvs.create false \ |
| && poetry install --no-interaction --no-ansi --no-root --only main |
|
|
| |
| COPY backend/ . |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| curl \ |
| wget \ |
| netcat-openbsd \ |
| git \ |
| && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ |
| && apt-get install -y nodejs \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY --from=frontend-build /app/build ./frontend/build |
| COPY --from=frontend-build /app/package*.json ./frontend/ |
| COPY --from=frontend-build /app/server.js ./frontend/ |
|
|
| |
| WORKDIR /app/frontend |
| RUN npm install --production |
| WORKDIR /app |
|
|
| |
| ENV HF_HOME=/app/.cache \ |
| TRANSFORMERS_CACHE=/app/.cache \ |
| HF_DATASETS_CACHE=/app/.cache \ |
| INTERNAL_API_PORT=7861 \ |
| PORT=7860 \ |
| NODE_ENV=production |
|
|
|
|
| |
| USER user |
| EXPOSE 7860 |
|
|
| |
| CMD ["sh", "-c", "env && uvicorn app.asgi:app --host 0.0.0.0 --port 7861 & while ! nc -z localhost 7861; do sleep 1; done && cd frontend && npm run serve"] |
|
|