From 252b84daad79f1101e7975fe0081b3264c62c745 Mon Sep 17 00:00:00 2001 From: raghu Date: Fri, 21 Feb 2025 15:11:34 -0500 Subject: [PATCH] add Dockerfile --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7fd65a0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Stage 1: Build the Angular application +FROM node:latest AS build-prod + +# Set working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json files for dependency installation +COPY package*.json ./ + +# Install specific version of Angular CLI globally +RUN npm install -g @angular/cli + +# Install project dependencies +RUN npm ci + +# Copy the rest of the application files +COPY . . + +# Build the Angular application for production +RUN npm run build + +# Stage 2: Serve the app with Nginx +FROM nginx:latest + +# Copy custom Nginx configuration file +COPY ./nginx.conf /etc/nginx/conf.d/default.conf + +# Copy the built Angular application to Nginx's default directory +COPY --from=build-prod /app/dist/rc-portfolio/browser /usr/share/nginx/html + +# Expose port 80 to allow access to the app +EXPOSE 80 + +# Start Nginx to serve the app +CMD ["nginx", "-g", "daemon off;"]