Created
September 17, 2021 22:04
-
-
Save andreciornavei/8f11ab9a38ff5328c07e27381dd30623 to your computer and use it in GitHub Desktop.
Deploy to AWS with docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) check if is everything ok on local machine using docker-compose | |
docker-compose up | |
# 2) run aws configure and set your credentials | |
aws configute | |
# or import your csv configuration | |
aws configure import --csv file://$PDW/aws-profile-credentials.csv | |
# 3) check if your credentials is currecly imported and configured | |
aws configure list | |
# 4) create a new machine ec2 on aws with docker-machine | |
docker-machine create --driver amazonec2 aws1 | |
# 5) get machine variables to access aws ec2 remotly using the name applied to amazonec2 | |
docker-machine env aws1 | |
# 6) copy the content resultsnt on the last step or just run the eval | |
eval $(docker-machine env aws1) | |
# 7) after run eval, docker is running on server ec2 machine | |
# then up docker build | |
docker-compose up -d --build | |
# 7.1) if you prefer, create a docker-production.yml and override your local docker-compose variables | |
docker-compose -f docker-compose-a.yml -f docker-compose-b.yml -f docker-production.yml up -b | |
# 8) After build your project on ec2, leave the remote machine | |
eval $(docker-machine env -u) | |
# 9) finally, to clear your system and volums if necessary | |
docker system prune -a | |
docker volume prune | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment