This commit is contained in:
Dennis Postma 2024-07-10 22:20:41 +02:00
parent 84421cbe92
commit 30863a7d84

View File

@ -10,9 +10,6 @@ COPY package*.json ./
# Install application dependencies # Install application dependencies
RUN npm install RUN npm install
# If you're building your code for production
# RUN npm ci --only=production
# Copy prisma schema # Copy prisma schema
COPY prisma ./prisma/ COPY prisma ./prisma/
@ -32,8 +29,10 @@ EXPOSE 80
ENV DATABASE_URL=mysql://root:BEVLqLReqUyA@srv-captain--nq-db:3306/new-quest ENV DATABASE_URL=mysql://root:BEVLqLReqUyA@srv-captain--nq-db:3306/new-quest
# Create a shell script to run migrations and start the application # Create a shell script to run migrations and start the application
RUN echo '#!/bin/sh\nnpx prisma migrate deploy\nnode dist/server.js' > /usr/src/app/start.sh RUN echo '#!/bin/sh' > /usr/src/app/start.sh && \
RUN chmod +x /usr/src/app/start.sh echo 'npx prisma migrate deploy' >> /usr/src/app/start.sh && \
echo 'node dist/server.js' >> /usr/src/app/start.sh && \
chmod +x /usr/src/app/start.sh
# Use the shell script as the entry point # Use the shell script as the entry point
CMD ["/usr/src/app/start.sh"] CMD ["/usr/src/app/start.sh"]