Build & Deploy / build-and-push (discord-gateway) (push) Failing after 2m22s
Build & Deploy / build-and-push (backend) (push) Failing after 3m22s
Build & Deploy / build-and-push (proxy) (push) Successful in 1m36s
Build & Deploy / deploy (push) Skipped
- Consolidate all DB schema definitions into packages/shared as single source of truth - Migrate backend from raw SQL to Drizzle ORM across all modules - Extract frontend inline UI into separate component files - Refactor discord-gateway circuitBreaker into conversationState + moderationState - Convert messageStore to Proxy singleton pattern - Add validateBody/validateQuery middleware + Zod schemas for API endpoints - Modernize Docker builds with multi-stage + pnpm deploy - Migrate CI/CD from deployment to image-based pipeline - Remove 60+ unused/dead files (~15K lines) - Update color scheme from sky-blue to teal-cyan - Move DB connection management to @bete/shared/database Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
1.6 KiB
Docker
61 lines
1.6 KiB
Docker
FROM node:22-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Build args for frontend API URLs
|
|
ARG VITE_BE_API_URL
|
|
ARG VITE_BE_WS_URL
|
|
ENV VITE_BE_API_URL=${VITE_BE_API_URL}
|
|
ENV VITE_BE_WS_URL=${VITE_BE_WS_URL}
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm
|
|
|
|
# Install build tools for native dependencies (node-crc, @discordjs/opus)
|
|
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends python3 make g++ wget && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN groupadd --system app && useradd --system -g app app
|
|
|
|
# Copy dependency definition files first for better caching
|
|
COPY pnpm-workspace.yaml .
|
|
COPY pnpm-lock.yaml .
|
|
COPY package.json .
|
|
|
|
# Copy patches (pnpm patchedDependencies)
|
|
COPY patches ./patches
|
|
|
|
# Copy packages (workspace dependencies)
|
|
COPY packages/shared ./packages/shared
|
|
|
|
# Copy service
|
|
COPY services/backend ./services/backend
|
|
|
|
# Install dependencies with build cache
|
|
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
|
pnpm install --frozen-lockfile
|
|
|
|
# Build shared workspace dependency first
|
|
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
|
pnpm --filter './packages/shared' run build
|
|
|
|
# Build backend
|
|
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
|
pnpm --filter './services/backend' run build
|
|
|
|
# Own dist + node_modules by non-root user
|
|
RUN chown -R app:app /app
|
|
|
|
# Switch to non-root user
|
|
USER app
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Healthcheck — backend serves HTTP on port 3000
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
|
CMD wget -qO- http://localhost:3000/api/health || exit 1
|
|
|
|
# Start backend
|
|
CMD ["node", "services/backend/dist/index.js"]
|