From 2e25b5b9b12cb0baefd2a9881a63f874a00cd321 Mon Sep 17 00:00:00 2001 From: OomsOoms Date: Sun, 29 Sep 2024 23:13:47 +0100 Subject: [PATCH] Add .dockerignore and Dockerfile for server deployment --- server/.dockerignore | 8 ++++++++ server/Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 server/.dockerignore create mode 100644 server/Dockerfile diff --git a/server/.dockerignore b/server/.dockerignore new file mode 100644 index 0000000..3bec02e --- /dev/null +++ b/server/.dockerignore @@ -0,0 +1,8 @@ +# Ignore node_modules folder +node_modules +# Ignore logs +logs +# Ignore environment files +.env +# Ignore git directory +.git diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..86cf9eb --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Node.js image as the base image +FROM node:22.2.0-alpine + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package.json package-lock.json ./ + +# Install dependencies +RUN npm install --production + +# Copy the rest of the application code +COPY . . + +# Expose the port the app runs on +EXPOSE 3000 + +# Start the application, this uses cross-env to set the NODE_ENV to production +CMD ["npm", "run", "prod"] \ No newline at end of file