A reference to how I do my Laravel/Apache/MySQL setup using Docker and ECR
- Build Laravel/PHP & Nginx Docker images locally
- Push them to ECR
- Pull them in the docker-compose file, as well as the Docker image for MySQL
- Run the containers
sudo docker exec -it app_container_name php artisan migrate
sudo LE_DIR=./certs docker-compose -f docker-compose.prod.yml up -d
sudo docker image rm imagename
Need to have certs
folder on the server
https://certbot.eff.org/lets-encrypt/ubuntuother-apache - Need certonly as we reference the certs in the config anyway
After adding certbot to container
sudo docker exec -it site_app_1 certbot certonly
May want to set specific AWS keys with specific permissions for pulling/pushing on ECR repos.
You can do this nicely by making a new policy, this is documented in the aws
folder.
https://medium.com/@shakyShane/laravel-docker-part-2-preparing-for-production-9c6a024e9797