# Use the official Node.js 22.4.1 image FROM node:22.4.1-alpine # Set the working directory in the container WORKDIR /usr/src/app # Copy package.json and package-lock.json (if available) COPY package*.json ./ # Install application dependencies RUN npm install # If you're building your code for production # RUN npm ci --only=production # Copy prisma schema COPY prisma ./prisma/ # Generate Prisma client RUN npx prisma generate # Copy the rest of your application code to the container COPY . . # Build the application RUN npm run build # Expose the port your Node.js application will listen on EXPOSE 80 # Set environment variables ENV DATABASE_URL=mysql://root:BEVLqLReqUyA@srv-captain--nq-db:3306/new-quest # 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 chmod +x /usr/src/app/start.sh # Use the shell script as the entry point CMD ["/usr/src/app/start.sh"]