|- app
|- index.js
|- controllers/
|- middlewares/
|- routes/
|- models/
|- config/
|- nginx/
|- package.json
|- package-lock.json
|- Dockerfile
|- docker-compose.yml
|- docker-compose.prod.yml
|- docker-compose.dev.yml
|- docker-compose.backup.yml
|- .gitignore
|- .dockerignore
|- docker-compose-down.sh
|- docker-compose-up.sh
./docker-compose-up.sh
./docker-compose-down.sh
docker compose --env-file .env -f docker-compose.yml -f docker-compose.prod.yml up -d --build
docker compose -f docker-compose.yml -f docker-compose.prod.yml down
To re-build a specific image on production (eg. mongodb & nginx images may not be needed to re-build every-time application-logic changes...)
docker compose --env-file .env -f docker-compose.yml -f docker-compose.prod.yml up -d --build backend
here image that must be re-build is backend
we can even pass --no-deps
flag to not re-build the image on that the our changing image depends
Developer build image on dev server it-self & push it to dockerhub, then production server pull that image from dockerhub & run docker compose up
and starts all containers.
By building image on dev-server, it reduce compute power of production server which is good for application performance
Developer push changes to github, then production server takes git pull
& re-build the image which takes more compute power of production server which is not good for application. After re-building it run docker compose up
and starts all containers.
go to https://get.docker.com/