Basic 🐳docker-compose.yml

Restart policies in docker-compose files 👯

restart policies are important if any problem happens to our app so we tell the container to take an action based on the problem what we are talking about here is the restart keywork in the docker-compose files so these policies are

Tips & tricks 🤯

enhance the building speed

docker build and caches a temporary container after every step in your Dockerfile, so every time you edit the docker file it only creates the temp container in the edited lines and after and to enhance the building speed it is to follow these steps order in the Dockerfile

  1. COPY package.json .
  2. RUN npm install
  3. COPY . .

here we are copying the package.json file first then run npm install then copy the rest of the files so every time we edit our project files and build the image it only executes the 3rd line and use the cach for the rest one command like npm install on large projects might take a couple of minutes so this is a great save of build time.