This is a example project for ECS Fargate with ghcr (i.e private registry).
Warning
This solution will create a secret in a CloudFormation template. For production use, consider referencing the secret from the SecretsManager.
- Generate your GitHub PAT for image push.
- Access https://github.com/settings/tokens/new
- Check the
write:packages
- Click generate token button.
- Run following the command for prepush a image.
docker login ghcr.io -u <Your GitHub Name> --password <Your GitHub PAT for image push>
docker tag nginx:latest ghcr.io/<Your GitHub name>/nginx:latest
docker push ghcr.io/<Your GitHub name>/nginx:latest
- Generate your GitHub PAT for image pull.
- Access https://github.com/settings/tokens/new
- Check the
read:packages
- Click generate token button.
- Edit
bin/ecs-ghcr-cdk-example.ts
with your GitHub information. - Run
yarn cdk deploy
command. - Access the outputed URL by CDK
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template