This document outlines the steps to build, tag, and push the squareboat-media-service Docker image to AWS ECR (Elastic Container Registry).
- AWS CLI installed and configured
- Docker installed
- Access to your AWS account
- Valid AWS credentials with permissions to create and push to ECR repositories
First, create an ECR repository in your AWS account:
aws ecr create-repository --repository-name squareboat-media-service --region us-east-1
Take note of the repository URI provided in the response. It will look something like:
{account-id}.dkr.ecr.us-east-1.amazonaws.com/squareboat-media-service
Run the following command to authenticate your Docker client with your AWS ECR registry:
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin {your-repository-uri}
Note: If you receive an error, ensure that you have the latest versions of both AWS CLI and Docker installed.
Build your Docker image using:
docker build -t squareboat-media-service .
Skip this step if your image has already been built.
Tag your image with the ECR repository URI:
docker tag squareboat-media-service:latest {your-repository-uri}:latest
Push your tagged image to the ECR repository:
docker push {your-repository-uri}:latest
After successfully pushing the image, update the URI and tag in your serverless configuration file:
Open apps/media-service/serverless.yml
and update the image reference to:
# Example location in serverless.yml
functions:
mediaService:
image: {your-repository-uri}:latest
- Ensure your AWS CLI is properly configured with the correct credentials
- Verify Docker is running correctly on your system
- Check that you have the necessary permissions to push to the ECR repository
- If you encounter authentication issues, try running the authentication command again
Once the image is successfully pushed to ECR and your serverless.yml is updated, you can deploy your service using the appropriate deployment commands for your infrastructure.