diff --git a/ops/aws/useful-commands.md b/ops/aws/useful-commands.md new file mode 100644 index 0000000..1292172 --- /dev/null +++ b/ops/aws/useful-commands.md @@ -0,0 +1,63 @@ +# Useful Commands for AWS (ECR) + +## Install AWS CLI + +Download AWS CLI based on your OS:\ +https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html + +## Configure / Login to AWS + +``` bash +aws login +``` + +You'll be prompted for: - AWS Access Key ID\ +- AWS Secret Access Key\ +- Region (e.g. us-east-2)\ +- Output format (json) + +## Authenticate Docker to AWS ECR + +``` bash +aws ecr get-login-password --region us-east-2 \ +| docker login \ +--username AWS \ +--password-stdin .dkr.ecr..amazonaws.com +``` + +Example: + +``` bash +aws ecr get-login-password --region us-east-2 \ +| docker login \ +--username AWS \ +--password-stdin .dkr.ecr.us-east-2.amazonaws.com +``` + +## Docker Commands + +### Tagging Images + +``` bash +docker tag \ +.dkr.ecr..amazonaws.com/: +``` + +Example: + +``` bash +docker tag surigo/anizenith:latest \ +.dkr.ecr.us-east-2.amazonaws.com/anizenith-repo:latest +``` + +### Pushing Images + +``` bash +docker push +``` + +Example: + +``` bash +docker push .dkr.ecr.us-east-2.amazonaws.com/anizenith-repo:latest +``` diff --git a/ops/docker/useful-commands.md b/ops/docker/useful-commands.md index ddff91c..6d7f27e 100644 --- a/ops/docker/useful-commands.md +++ b/ops/docker/useful-commands.md @@ -2,17 +2,17 @@ ## Commands for building docker images ### Building backend image ```bash -docker build -t surigo/anizenith_backend:latest -f ./backend/Dockerfile --progress=plain --no-cache . +docker buildx build --platform linux/amd64 -t surigo/anizenith_backend:latest -f ./backend/Dockerfile --progress=plain --no-cache . ``` ### Building frontend image ```bash -docker build -t surigo/anizenith_frontend:latest -f ./frontend/Dockerfile --progress=plain --no-cache . +docker buildx build --platform linux/amd64 -t surigo/anizenith_frontend:latest -f ./frontend/Dockerfile --progress=plain --no-cache . ``` ### Building integrated image (backend + frontend) ```bash -docker build -t surigo/anizenith:latest -f ./Dockerfile --progress=plain --no-cache . +docker buildx build --platform linux/amd64 -t surigo/anizenith:latest -f ./Dockerfile --progress=plain --no-cache . ``` ## Commands for pushing docker images to dockerhub