# 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 # Copy package.json, strip sharp (native dep that needs build tools not on # Alpine), then do a full npm install so tsx/esbuild get their binaries and # all applesauce transitive deps resolve correctly. COPY package.json ./ RUN node -e "\ const p = JSON.parse(require('fs').readFileSync('package.json','utf8'));\ if (p.devDependencies) delete p.devDependencies.sharp;\ require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2));\ " && npm install --no-package-lock # 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 # set -ex: print each command before running, exit on first failure CMD ["sh", "-c", "set -ex && node scripts/wait-for-relay.mjs && npx tsx scripts/seed-profiles.ts && npx tsx scripts/seed-activity.ts && echo 'Seeding complete!'"]