docker / awesome-compose

Awesome Docker Compose samples
https://docs.docker.com/compose/
Creative Commons Zero v1.0 Universal
34.57k stars 6.64k forks source link

Updated README.md at /react-express-mongodb /backend/ #405

Open Thoshinny-cyber opened 10 months ago

Thoshinny-cyber commented 10 months ago

Enhanced Dockerfile snippet and it's explanation in README.md

The Dockerfile snippet in the README.md file required adjustments to align it more closely with the actual Dockerfiles in both the Backend and Frontend directories. I've made few improvements to ensure clarity and accuracy.

Original Snippet in Repository:

FROM node:13.13.0-stretch-slim
# Argument passed from docker-compose.yaml file
ARG NODE_PORT
# Echo the argument to check if it's loaded correctly RUN echo "Argument port is: $NODE_PORT"
# Create app directory
WORKDIR /usr/src/app
# Copy entire content
COPY . .
# Install app dependencies
RUN npm install
#In my case my app binds to port NODE_PORT so you'll use the EXPOSE instruction to have it mapped by the docker daemon:
EXPOSE ${NODE_PORT}
CMD npm run dev

Modified Snippet:

FROM node:13.13.0-stretch-slim
#Argument that is passed from docker-compose.yaml file
ARG NODE_PORT
#Echo the argument to check passed argument loaded here correctly
RUN echo "Argument port is : $NODE_PORT"
# Create app directory
WORKDIR /usr/src/app
# Copy dependency definitions
COPY package.json /usr/src/app
# Install app dependencies
RUN npm install
# Get all the code needed to run the app
COPY . /usr/src/app
#In my case my app binds to port NODE_PORT so you'll use the EXPOSE instruction to have it mapped by the docker daemon:
EXPOSE ${NODE_PORT}
CMD npm run dev

These changes ensure better understanding and readability.

I've updated the README.md explanation for the updated snippet.