a basic project for your initial using of dockerized and automated laravel ^8.0 projects
- laravel 8.0
- mysql
- nginx
- docker
- docker-swarm
- docker-compose
- github actions
- in this project we used nginx for load balancing and reverse proxy with basic configs
- two version of docker-compose file for development and production mode
- we set configs for docker swarm basic configs
- github actions workflow for test and deploy for build and push docker image to you dockerhub
nginx
: in this folder and in default.conf file we define nginx load balancing configsdb
: this folder is volume for mysql image for persisting its dataapp
: this folder is volume of main app and you can modify this folder in development mode.
development
: running in development mode we use docker-compose.dev.yml and docker-compose.yml. use following code in command line:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
production
:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
note : if you wanna rebuild Dockerfile you can add
--build
in the end of commands
note : if you wanna stop the runnig dockerized system use
down
instead ofup
steps
:
- For install the docker on ubuntu server use following link:
note: if you wanna install docker-compose use following link:
digitalOcean
- login to your docker hub account
docker login
-
clone the repo with git
-
init the docker swarm with:
docker swarm init --advertise-addr `YOUR IP`
this command will make manager node that can handle the containers
- use following command to start deploying:
docker stack deploy --with-registry-auth -c `YOUR DOCKER COMPOSE FILE` `DOCKER SWARM NAME`
if it has not pull the image from docker hub you can pull the image manualy
docker pull `IMAGE NAME`