This guide contains instructions on how to:
- Create GitHub Repository
- Create Golang App
- Create Dockerfile for Golang
- Create GitHub Actions Workflow
- Create AWS ECR Repository
- Create AWS IAM User, Policy, and Group
- Test GitHub Actions
- Add Automatic Tagging of Releases
- Create GitHub repo
lesson-086 - Clone repository
git clone git@github.com:antonputra/lesson-086.git- Initialize the Go module
go mod init github.com/antonputra/lesson-086-
Create
main.gofile -
Format the code and run it
# go install golang.org/x/tools/cmd/goimports@latest go mod tidy goimports -w . go run main.go- Create
Dockerfile
- Create
.github/workflows/main.ymlfile, uselatestforIMAGE_TAG
- Go to AWS console, search for
ecr - Create private ECR repository
lesson-086
- Create IAM Policy
AllowPushPullPolicy
{ "Version": "2012-10-17", "Statement": [ { "Sid": "GetAuthorizationToken", "Effect": "Allow", "Action": [ "ecr:GetAuthorizationToken" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ecr:BatchGetImage", "ecr:BatchCheckLayerAvailability", "ecr:CompleteLayerUpload", "ecr:GetDownloadUrlForLayer", "ecr:InitiateLayerUpload", "ecr:PutImage", "ecr:UploadLayerPart" ], "Resource": [ "arn:aws:ecr:us-east-1:424432388155:repository/lesson-086" ] } ] }-
Create
push-pull-imagesIAM Group and attachAllowPushPullPolicyIAM Policy -
Create user
github-actionsand place it topush-pull-imagesIAM Group
- Create initial commit
git add . git commit -m 'init commit' git push origin main- Check ECR repository
-
Create
build/git_update.shscript -
Make a change and push to remote branch from
main -
Create a new branch
aputra, make a change, updatepatch->majorand push
- Delete
github-actionsAWS IAM User - Delete
AllowPushPullPolicyAWS IAM Policy - Delete
push-pull-imagesAWS IAM Group