Without a backend API server in the Docker deployment, the app was trying to reach localhost:4000 causing a 30s timeout on page load (content store) and a connection error on Nostr login (auth store). Setting VITE_USE_MOCK_DATA=true makes both use the built-in mock data and local Nostr relay instead. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
891 B
Docker
43 lines
891 B
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Clear VITE_NOSTR_RELAYS so the app auto-detects the relay
|
|
# via the /relay nginx proxy at runtime (instead of hardcoding localhost)
|
|
ENV VITE_NOSTR_RELAYS=""
|
|
|
|
# Enable mock data mode — no backend API server in this deployment,
|
|
# so auth and content use built-in mock/local data instead of timing out
|
|
ENV VITE_USE_MOCK_DATA=true
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Install curl for health checks
|
|
RUN apk add --no-cache curl
|
|
|
|
# Copy custom nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built assets from builder stage
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Expose port 7777
|
|
EXPOSE 7777
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|