Run database migrations on startup

This commit is contained in:
Brendon Heinst 2026-02-24 15:42:03 +01:00
parent 4ec3d91b5d
commit 41aff1c8bc
2 changed files with 7 additions and 1 deletions

View file

@ -8,5 +8,6 @@ RUN npm run build
FROM node:20-alpine FROM node:20-alpine
WORKDIR /app WORKDIR /app
COPY --from=builder /app . COPY --from=builder /app .
RUN chmod +x start.sh
EXPOSE 9000 EXPOSE 9000
CMD ["npx", "medusa", "start"] CMD ["sh", "start.sh"]

5
start.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/sh
echo "Running database migrations..."
npx medusa db:migrate
echo "Starting Medusa server..."
npx medusa start