feat: auto-seed admin user on backend startup
This commit is contained in:
parent
994becc687
commit
4a22e8a18a
@ -33,6 +33,7 @@ RUN addgroup -g 1001 -S nodejs && \
|
|||||||
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
|
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
|
||||||
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
|
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
|
||||||
COPY --from=builder --chown=nodejs:nodejs /app/package*.json ./
|
COPY --from=builder --chown=nodejs:nodejs /app/package*.json ./
|
||||||
|
COPY --chown=nodejs:nodejs docker-entrypoint.sh ./
|
||||||
|
|
||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
USER nodejs
|
USER nodejs
|
||||||
@ -45,4 +46,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Start application
|
# Start application
|
||||||
CMD ["node", "dist/src/main.js"]
|
CMD ["sh", "docker-entrypoint.sh"]
|
||||||
|
|||||||
12
backend/docker-entrypoint.sh
Executable file
12
backend/docker-entrypoint.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Backend entrypoint script - seeds admin on first run
|
||||||
|
|
||||||
|
echo "Starting Placebo.mk Backend..."
|
||||||
|
|
||||||
|
# Run admin seed script (idempotent - won't recreate if exists)
|
||||||
|
echo "Checking for admin user..."
|
||||||
|
node dist/scripts/seed-admin.js
|
||||||
|
|
||||||
|
# Start the application
|
||||||
|
echo "Starting NestJS application..."
|
||||||
|
exec node dist/src/main.js
|
||||||
Loading…
Reference in New Issue
Block a user