A project template for Laravel on Docker.
- Open your shell's "rc file" (Eg:
.bashrcand.zshrc.) and add following lines:
export UID
export GID
- Clone this repo.
- Go inside the repo directory.
- Run
docker-compose up -d. - Go inside the
phpcontainer withmake shell. - Make sure you're in the
/appdirectory. - Empty directory with
rm -rf * .*. - Run
composer create-project --prefer-dist laravel/laravel .. - Copy of the content of the
src/.envfile to theenv/main.envfile, and delete thesrc/.envfile. - Copy the content of the
env/main.envfile toenv/tmp.main.env, but remove the sensitive data like passwords or API keys. exitout of thephpcontainer.- Run
docker-compose down. - Remove the
src/vendordirectory. - Open
docker-compose.ymlfile and uncomment the- ./vols/vendor/:/app/vendor/line. - Run
docker-compose up -d. - Run
make shell. - Inside the
phpcontainer, runcomposer install. - Go to
localhost:8000and make sure Laravel is running.
- Run
docker-compose -f prod.docker-compose.yml build. - Run
docker imagesto make sure a new Docker Image with the tagdockerhub-username/project-name:latestis created (You can change the resulting image name in theprod.docker-compose.ymlfile.). - Tag it as you wish and push to Docker Hub.