This commit is contained in:
Dennis Postma 2024-07-10 22:17:04 +02:00
parent 84f8574705
commit 7e36f17053

View File

@ -1,20 +1,23 @@
# Use the official Node.js 22.4.1 image # Use the official Node.js 22.4.1 image
FROM node:22.4.1-alpine 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 # Set the working directory in the container
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install application dependencies # Install application dependencies
RUN npm install RUN npm install
# Build the application # If you're building your code for production
RUN npm run build # RUN npm ci --only=production
# Copy the rest of your application code to the container # 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 the port your Node.js application will listen on
EXPOSE 80 EXPOSE 80
@ -22,8 +25,5 @@ EXPOSE 80
# Set environment variables # Set environment variables
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
# Use nodemon for development (install it globally) # Use node to run the application
RUN npm install -g nodemon CMD ["node", "dist/server.js"]
# Define the startup command using nodemon
CMD ["nodemon", "dist/server.js"]