Build & Deploy / build-and-push (backend) (push) Failing after 1m25s
Build & Deploy / build-and-push (discord-gateway) (push) Failing after 26s
Build & Deploy / build-and-push (proxy) (push) Failing after 25s
Backend: - node:22-alpine runtime (from 1.82GB to 294MB, 84% reduction) - COPY --chown instead of chown -R layer - pnpm install --prod after build for clean .pnpm store - Pinned pnpm@10 to avoid v11 build-script lockout Gateway: - Fixed TypeScript errors (missing table defs in shared schema) - Restored node-crc Rust patch for native compilation - Multi-stage build with COPY --chown - pnpm install --prod after build - ffmpeg with --no-install-recommends Proxy: - Restructured for standalone build (build errors are pre-existing) General: - pnpm@10 in all builds (avoids ERR_PNPM_IGNORED_BUILDS) - Clean .dockerignore (excludes docs/design/scripts)
53 lines
1.6 KiB
Docker
53 lines
1.6 KiB
Docker
# ---- Builder stage ----
|
|
FROM node:22-slim AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
RUN npm install -g pnpm@10
|
|
|
|
# Build tools + Rust (required by napi-rs native addons)
|
|
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
|
|
python3 make g++ curl ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Rust toolchain
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
|
|
COPY services/discord-gateway/ ./
|
|
|
|
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
|
pnpm install --no-frozen-lockfile
|
|
|
|
RUN ./node_modules/.bin/tsc
|
|
|
|
# Strip debug symbols from native addons
|
|
RUN find node_modules -name '*.node' -exec strip -s {} \; 2>/dev/null; \
|
|
find node_modules -name '*.so' -exec strip -s {} \; 2>/dev/null; \
|
|
echo "Stripped native binaries"
|
|
|
|
# Switch to production-only deps
|
|
RUN rm -rf node_modules && pnpm install --prod --no-frozen-lockfile
|
|
|
|
# ---- Runtime stage ----
|
|
FROM node:22-slim
|
|
|
|
# Install ffmpeg with minimal dependencies
|
|
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
|
|
ffmpeg ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder --chown=node:node /build/dist ./dist
|
|
COPY --from=builder --chown=node:node /build/node_modules ./node_modules
|
|
COPY --from=builder --chown=node:node /build/package.json ./
|
|
COPY --from=builder --chown=node:node /build/drizzle ./drizzle
|
|
|
|
RUN mkdir -p /app/recordings
|
|
USER node
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
|
CMD node -e "process.exit(0)"
|
|
|
|
CMD ["node", "dist/index.js"]
|