diff --git a/Dockerfile b/Dockerfile index cb838d4..dac9091 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,23 @@ # Use the official Node.js 22.4.1 image FROM node:22.4.1-alpine -# Create a directory for the application code -RUN mkdir -p /usr/src/app - # 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 -# Build the application -RUN npm run build +# If you're building your code for production +# RUN npm ci --only=production # Copy the rest of your application code to the container -COPY . /usr/src/app +COPY . . + +# Build the application +RUN npm run build # Expose the port your Node.js application will listen on EXPOSE 80 @@ -22,8 +25,5 @@ EXPOSE 80 # Set environment variables ENV DATABASE_URL=mysql://root:BEVLqLReqUyA@srv-captain--nq-db:3306/new-quest -# Use nodemon for development (install it globally) -RUN npm install -g nodemon - -# Define the startup command using nodemon -CMD ["nodemon", "dist/server.js"] \ No newline at end of file +# Use node to run the application +CMD ["node", "dist/server.js"] \ No newline at end of file