21 lines
503 B
Docker
21 lines
503 B
Docker
# Use a slim, Debian-based Node.js runtime for better compatibility
|
|
FROM node:18-slim
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy package.json and package-lock.json to leverage Docker's layer caching
|
|
COPY package*.json ./
|
|
|
|
# Install app dependencies
|
|
RUN npm install --omit=dev
|
|
|
|
# Copy all project files, including the 'public' directory, into the container
|
|
COPY . .
|
|
|
|
# Make port 3000 available
|
|
EXPOSE 3000
|
|
|
|
# Define the command to run your app
|
|
CMD [ "node", "server.js" ]
|