diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 79adcf6..6fb19ae 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -35,11 +35,13 @@ RUN npx prisma generate \ && cd apps/api && npx nest build # Use pnpm deploy to produce a flat, production-only node_modules -# Then re-generate Prisma client inside pruned dir (pnpm deploy doesn't carry .prisma) +# Then install prisma + generate client in pruned dir (pnpm deploy strips dev deps) RUN pnpm deploy --legacy --filter @goodgo/api --prod /app/pruned \ && cd /app/pruned \ && cp -r /app/prisma ./prisma \ - && npx prisma generate + && npm install --no-save prisma @prisma/client \ + && npx prisma generate \ + && npm remove --no-save prisma # ---- Production ---- FROM node:22-slim AS production diff --git a/libs/ai-services/Dockerfile b/libs/ai-services/Dockerfile index f7c432c..d0f2d16 100644 --- a/libs/ai-services/Dockerfile +++ b/libs/ai-services/Dockerfile @@ -6,17 +6,20 @@ WORKDIR /app RUN apt-get update && \ apt-get install -y --no-install-recommends gcc g++ dumb-init curl && \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal && \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/* && \ + echo 'export PATH="/root/.cargo/bin:$PATH"' >> /etc/profile.d/cargo.sh +ENV PATH="/root/.cargo/bin:${PATH}" COPY pyproject.toml . -RUN . /root/.cargo/env && \ - pip install --no-cache-dir maturin && \ +# Install maturin first, then deps with --no-build-isolation for packages needing Rust +RUN /root/.cargo/bin/cargo --version && \ + pip install --no-cache-dir maturin setuptools wheel && \ + pip install --no-cache-dir --no-build-isolation "underthesea==6.8.0" && \ (pip install --no-cache-dir . 2>/dev/null || pip install --no-cache-dir \ "fastapi==0.115.0" \ "uvicorn[standard]==0.32.0" \ "xgboost==2.1.0" \ "numpy==1.26.4" \ - "underthesea==6.8.0" \ "pydantic==2.9.0" \ "pydantic-settings==2.5.0" \ "httpx==0.27.0" \