Some checks are pending
Build / build (push) Waiting to run
Deploy / deploy (push) Waiting to run
Lint & Type Check / lint (push) Waiting to run
Security Scan / semgrep (push) Waiting to run
Security Scan / dependency-check (push) Waiting to run
Test / test (18.x) (push) Waiting to run
Test / test (20.x) (push) Waiting to run
Vite dev mode is incompatible with Discord Activity's iframe CSP — the HMR WebSocket is blocked which breaks the React JSX dev runtime (_jsxDEV). - Build client (vite build) during Docker image build so dist/spa/ exists - Add express.static serving dist/spa/ assets in server/index.ts - Add SPA catch-all to serve dist/spa/index.html for non-API routes The Activity now loads the production compiled bundle instead of Vite's dev-mode TypeScript modules, resolving the _jsxDEV crash. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
636 B
Docker
27 lines
636 B
Docker
FROM node:22-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json package-lock.json* pnpm-lock.yaml* npm-shrinkwrap.json* ./
|
|
|
|
# Install dependencies
|
|
RUN if [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm install --frozen-lockfile; \
|
|
elif [ -f package-lock.json ]; then npm ci --legacy-peer-deps; \
|
|
else npm install --legacy-peer-deps; fi
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the client so the Activity gets compiled JS (no Vite dev mode in Discord iframe)
|
|
RUN npm run build:client
|
|
|
|
# Set environment
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Start the server
|
|
CMD ["npm", "run", "dev"]
|