From d25970bd9769d58a811109d6d7a4f4d8b8f91965 Mon Sep 17 00:00:00 2001 From: Pradum Chintamani <80237284+pradumchintamani@users.noreply.github.com> Date: Sun, 23 Jun 2024 15:00:25 +0530 Subject: [PATCH] Create Dockerfile --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c512f46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# ------------------- Stage 1: Build Stage ------------------------------ +FROM node:21 AS frontend-builder + +# Set the working directory to /app +WORKDIR /app + +# Copy the package.json and package-lock.json for dependency installation +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# ------------------- Stage 2: Final Stage ------------------------------ +FROM node:21-slim + +# Set the working directory to /app +WORKDIR /app + +# Copy built assets and dependencies from frontend-builder stage +COPY --from=frontend-builder /app . + +# Copy the .env.sample file to .env.local +COPY .env.docker .env.local + +# Expose port 5173 for the Node.js application +EXPOSE 5173 + +# Define the default command to run the application in development mode +CMD ["npm", "run", "dev", "--", "--host"]