From bd690e2fb740772e7a000202dc28d4b45bbbeffe Mon Sep 17 00:00:00 2001 From: Nitin Singh Date: Sat, 2 Mar 2024 13:31:43 -0500 Subject: [PATCH] updated readme --- api/README.md | 36 +++++------------------------------- frontend/README.md | 35 +++++++++++++++++++++++++---------- loadbalancer/README.md | 3 ++- mongo/README.md | 1 - 4 files changed, 32 insertions(+), 43 deletions(-) diff --git a/api/README.md b/api/README.md index 1bd58dc..83e17ff 100644 --- a/api/README.md +++ b/api/README.md @@ -8,7 +8,7 @@ Run `npm run dev-server` to start the api server in development mode (using node ### Dockerfile Production ```dockerfile -FROM node:12.8-alpine +FROM node:21-alpine # Copy dependency definitions COPY package.json package-lock.json ./ @@ -16,8 +16,8 @@ COPY package.json package-lock.json ./ # disabling ssl for npm for Dev or if you are behind proxy RUN npm set strict-ssl false -## installing and Storing node modules on a separate layer will -## prevent unnecessary npm installs at each build + +## installing and Storing node modules on a separate layer will prevent unnecessary npm installs at each build RUN npm i && mkdir /app && mv ./node_modules ./app # Change directory so that our commands run inside this new directory @@ -29,34 +29,8 @@ COPY . /app/ # Expose the port the app runs in EXPOSE 3000 -# Serve the app -CMD ["npm", "start"] - -``` -### Dockerfile Development -```dockerfile -# Create image based off of the official 12.8-alpine -FROM node:14 - -# disabling ssl for npm for Dev or if you are behind proxy -RUN npm set strict-ssl false - -# Change directory so that our commands run inside this new directory -WORKDIR /api - -# Copy dependency definitions -COPY package.json ./ - -## installing node modules -RUN npm i - - -COPY . . - -# Expose the port the app runs in -EXPOSE 3000 +USER node # Serve the app -CMD [ "npm", "run", "dev-server" ] - +CMD ["npm", "start"] ``` diff --git a/frontend/README.md b/frontend/README.md index e4ac40a..3700ae2 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -44,16 +44,16 @@ Describes which version . ```dockerfile # Create image based off of the official Node 10 image -FROM node:16-alpine as builder +FROM node:21-alpine as builder # Copy dependency definitions COPY package.json package-lock.json ./ -# disabling ssl for npm for Dev or if you are behind proxy -RUN npm set strict-ssl false +RUN npm install -g npm@9.1.2 ## installing and Storing node modules on a separate layer will prevent unnecessary npm installs at each build -RUN npm ci && mkdir /app && mv ./node_modules ./app +## --legacy-peer-deps as ngx-bootstrap still depends on Angular 14 +RUN npm i --legacy-peer-deps && mkdir /app && mv ./node_modules ./app # Change directory so that our commands run inside this new directory WORKDIR /app @@ -64,22 +64,37 @@ COPY . /app/ # Build server side bundles RUN npm run build:ssr -FROM node:14.5-alpine +FROM node:21-alpine ## From 'builder' copy published folder -COPY --from=builder /app/dist/frontend /app +COPY --from=builder /app /app WORKDIR /app # Expose the port the app runs in EXPOSE 4000 -CMD ["node", "server/main.js"] +USER node + +CMD ["node", "dist/frontend/server/main.js"] ``` ### Dockerfile Development mode ```dockerfile + # Create image based off of the official 12.8-alpine -FROM node:14 +FROM node:21-alpine + +#RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null +WORKDIR /app -## Further help +# Copy dependency definitions +COPY package*.json ./ -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). +## installing and Storing node modules on a separate layer will prevent unnecessary npm installs at each build +RUN npm i --legacy-peer-deps --unsafe-perm=true --allow-root + +RUN npm install -g @angular/cli + +COPY . /app/ + +EXPOSE 4200 49153 +``` diff --git a/loadbalancer/README.md b/loadbalancer/README.md index e316894..66d5c3c 100644 --- a/loadbalancer/README.md +++ b/loadbalancer/README.md @@ -8,13 +8,14 @@ FROM nginx # Copy the configuration file from the current directory and paste # it inside the container to use it as Nginx's default config. + COPY nginx.conf /etc/nginx/nginx.conf # Port 8080 of the container will be exposed and then mapped to port # 8080 of our host machine via Compose. This way we'll be able to access the server via localhost:8080 on our host. EXPOSE 8000 # Start Nginx when the container has provisioned. -CMD ["nginx", "-g", "daemon off;"] +CMD ["nginx", "-g", "daemon off;"\]](README.md) ``` ### NGINX config diff --git a/mongo/README.md b/mongo/README.md index 343e457..2ce795c 100644 --- a/mongo/README.md +++ b/mongo/README.md @@ -5,7 +5,6 @@ We have used mongo db image and for data seed used `docker-entrypoint-initdb.d` and shell script is in file `init-mongo.sh` - Also, we have used mongo import to seed data :