From c4c723d60a614c0d0752369d58f532e84f33d971 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Wed, 20 Nov 2024 19:05:39 +0300 Subject: [PATCH] build(docker): create dockerfile and .dockerignore files --- .dockerignore | 6 ++++++ dockerfile | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .dockerignore create mode 100644 dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5f79269 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.git +.DS_Store +npm-debug.log +*test +*.log diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..7547004 --- /dev/null +++ b/dockerfile @@ -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"]