build(docker): create dockerfile and .dockerignore files

This commit is contained in:
Ryan Mwangi 2024-11-20 19:05:39 +03:00
parent 29208d8b4d
commit c4c723d60a
2 changed files with 26 additions and 0 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
.git
.DS_Store
npm-debug.log
*test
*.log

20
dockerfile Normal file
View File

@ -0,0 +1,20 @@
# Use an official Node.js runtime as a parent image
FROM node:18-alpine
# Set working directory inside the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json for installing dependencies
COPY package*.json ./
# Install dependencies
RUN npm install --production
# Copy the rest of the project files
COPY . .
# Expose the port your application runs on (if applicable)
EXPOSE 3000
# Command to run the application
CMD ["node", "src/server.js"]