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"]