- Use npm ci --omit=dev to avoid building sharp (needs native libvips not available on Alpine) then install tsx separately - Change app depends_on from seeder (service_completed_successfully) to relay only, so the app still starts even if seeding fails Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
858 B
Docker
25 lines
858 B
Docker
# Seeder container — populates the Nostr relay with test profiles,
|
|
# reactions, and comments so the dev deployment has content.
|
|
#
|
|
# Runs once and exits. docker-compose "restart: no" keeps it from looping.
|
|
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install only production deps (skip sharp & other heavy devDeps),
|
|
# then add tsx separately so we can run TypeScript seed scripts.
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev && npm install --no-save tsx
|
|
|
|
# Copy only what the seed scripts need
|
|
COPY scripts/ ./scripts/
|
|
COPY src/data/testPersonas.ts ./src/data/testPersonas.ts
|
|
COPY tsconfig.json ./
|
|
|
|
# Default env (overridden by docker-compose)
|
|
ENV RELAY_URL=ws://relay:8080
|
|
ENV ORIGIN=http://localhost:7777
|
|
|
|
CMD ["sh", "-c", "node scripts/wait-for-relay.mjs && npx tsx scripts/seed-profiles.ts && npx tsx scripts/seed-activity.ts && echo '✅ Seeding complete!'"]
|