- run:
curl https://wordpress.org/latest.tar.gz | sudo tar zx -C .
mv wordpress/* ./
rmdir wordpress
- run:
curl -LO https://github.com/docker-library/wordpress/raw/master/latest/php7.4/apache/Dockerfile
curl -LO https://raw.githubusercontent.com/docker-library/wordpress/master/latest/php7.4/apache/docker-entrypoint.sh
curl -LO https://raw.githubusercontent.com/docker-library/wordpress/master/latest/php7.4/apache/wp-config-docker.php
-
edit Dockerfile to copy local files instead of downloading tar from wordpress.org
-
edit Dockerfile to ensure docker-entrypoint.sh has execution permissions
docker build -t akuma5157/ctwp .
docker run --rm -it --name ctwp -p 8080:80 akuma5157/ctwp:latest
- get sample yaml from https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages and write to workflow file
- update conditional to enable builds on each push to any branch
- get sample docker-compose.yml from https://docs.docker.com/samples/wordpress
- update container image name, port, DB creds and volume mounts in docker-compose.yml
- test compose file with:
docker-compose up
# check app on browser
docker-compose down
- install compose-cli. run:
curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh
- reload shell session
exec bash
- ensure aws configuration profile is present
- set up ecs context and create stack with:
docker context create ecs myecscontext --profile default
docker context use myecscontext ecs
docker compose up
Provision all the AWS resources you used via CloudFormation or Terraform or any other infrastructure as code framework
- ensure compose stack is up on ecs
docker compose up
- convert compose stack to cloudformation template
docker compose convert > cloudformation.yml
- add autoscaling properties to wordpress service in docker-compose.yml
- Create a policy as recommended at Docker ECS Integration Prerequisites, see example.
- Create a group for all principals that will be handling this set of resources. e.g. your local cli, github-actions etc.
- Create separate users for all principals and add them to your group.
- Disable access keys when not being actively used.
run in any shell with proper aws profile and binaries:
docker compose down