Skip to content

Commit 35e606b

Browse files
committed
feat(docker): create startup script for migrations and application start
1 parent 83e2b2c commit 35e606b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

apps/cms/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,12 @@ RUN mkdir -p /app/apps/cms/uploads
5555
EXPOSE 3001
5656
ENV NODE_ENV=production
5757
ENV PORT=3001
58-
CMD ["pnpm", "--filter=cms", "start"]
58+
59+
# Create a startup script that runs migrations then starts the app
60+
RUN echo '#!/bin/sh\n\
61+
echo "Running database migrations..."\n\
62+
pnpm --filter=cms payload migrate\n\
63+
echo "Starting CMS application..."\n\
64+
pnpm --filter=cms start' > /app/start.sh && chmod +x /app/start.sh
65+
66+
CMD ["/app/start.sh"]

0 commit comments

Comments
 (0)