Skip to content

Docs: Publish app to AWS ECR + AppRunner using dockerfile.minimal and build scripts #23

Description

@fernando-plank

Please generate a documentation teaching how to publish this app from scratch to aws ECR + AppRunner using a docker image, in the project we're using the dockerfile.minimal to generate the image and using the build-simple.sh, and then docker-build.sh, and then run-docker.sh.

Agent Context [ "**1. Prerequisites and Setup**\n\n - **Install AWS CLI**: Provide instructions for installing and configuring the AWS Command Line Interface.\n - **Install Docker**: Provide instructions for installing Docker Desktop or Docker Engine.\n - **AWS Account Setup**: Guide the user to ensure they have an AWS account with an IAM user that has permissions for AWS ECR (Elastic Container Registry) and AWS AppRunner. Recommend configuring the AWS CLI with a default region.\n\n**2. Build Application and Docker Image**\n\n - **Build Application**: Explain that the application needs to be built before creating the Docker image. Instruct the user to run the `build-simple.sh` script from the repository root to compile the TypeScript projects: `bash build-simple.sh`.\n - **Build Docker Image**: Provide the command to build the Docker image using `dockerfile.minimal`. Explain the tagging convention for ECR. Example: `docker build -f dockerfile.minimal -t open-swe-minimal:latest .`\n\n**3. Create ECR Repository and Push Image**\n\n - **Create ECR Repository**: Instruct the user to create a new ECR repository in their AWS account. Provide the AWS CLI command for this: `aws ecr create-repository --repository-name open-swe-minimal --image-tag-mutability MUTABLE --image-scanning-configuration scanOnPush=true`.\n - **Authenticate Docker to ECR**: Provide the AWS CLI command to get the ECR login password and authenticate Docker: `aws ecr get-login-password --region | docker login --username AWS --password-stdin .dkr.ecr..amazonaws.com`.\n - **Tag Docker Image**: Instruct the user to tag the locally built Docker image with the ECR repository URI. Example: `docker tag open-swe-minimal:latest .dkr.ecr..amazonaws.com/open-swe-minimal:latest`.\n - **Push Image to ECR**: Provide the command to push the tagged Docker image to the ECR repository: `docker push .dkr.ecr..amazonaws.com/open-swe-minimal:latest`.\n\n**4. Configure and Deploy to AWS AppRunner**\n\n - **Review AppRunner Configuration**: Explain the contents of `app-runner-env.json` (file path: `app-runner-env.json`), specifically focusing on `ImageRepository.ImageIdentifier` (which needs to be updated with the ECR image URI), `ImageConfiguration` (Port, HealthCheckConfiguration), and `RuntimeEnvironmentVariables`. Emphasize the importance of setting sensitive environment variables as secrets in AppRunner.\n - **Create AppRunner Service Role**: Instruct the user to ensure an IAM service role for AppRunner exists with permissions to access ECR. The `app-runner-env.json` references `arn:aws:iam:::role/service-role/AppRunnerECRAccessRole`. Guide them to create this role if it doesn't exist, ensuring it has the `AWSAppRunnerServicePolicyForECRAccess` managed policy attached.\n - **Create AppRunner Service**: Provide the AWS CLI command to create the AppRunner service using the `app-runner-env.json` file. Instruct the user to update the `ImageIdentifier` in `app-runner-env.json` with their ECR image URI before running the command. Example: `aws apprunner create-service --cli-input-json file://app-runner-env.json`.\n - **Monitor Deployment**: Advise the user to monitor the deployment status in the AWS AppRunner console or via AWS CLI commands like `aws apprunner describe-service --service-id `." ]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions