Skip to content

Commit

Permalink
Merge pull request #678 from mozilla-iam/login-dockerhub
Browse files Browse the repository at this point in the history
chore(codebuild): Login to dockerhub
  • Loading branch information
bkochendorfer authored Jun 9, 2022
2 parents 5f43f0c + 3f393fd commit 709f409
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ phases:
- echo "running for ${COMMIT_SHA} in ${DEPLOY_ENV}"
- aws ecr get-login --region us-west-2 --no-include-email | bash
- echo "Logging Into Docker Hub"
- echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin registry-1.docker.io
- echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin
build:
commands:
- if [ "$PR" = 1 ]; then myke docker; fi
Expand Down
17 changes: 13 additions & 4 deletions terraform/codebuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ resource "aws_codebuild_project" "build" {

environment_variable {
name = "DOCKERHUB_USERNAME"
type = "PARAMETER_STORE"
value = " /iam/dino-park-front-end/mozilla/DOCKERHUB_USERNAME"
type = "SECRETS_MANAGER"
value = "/CodeBuild/dockerhub:username"
}

environment_variable {
name = "DOCKERHUB_PASSWORD"
type = "PARAMETER_STORE"
value = "/iam/dino-park-front-end/mozilla/DOCKERHUB_PASSWORD"
type = "SECRETS_MANAGER"
value = "/CodeBuild/dockerhub:password"
}
}

Expand Down Expand Up @@ -127,6 +127,15 @@ resource "aws_iam_role_policy" "codebuild" {
"eks:DescribeCluster"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Resource": [
"arn:aws:secretsmanager:*:*:secret:/CodeBuild/dockerhub*"
],
"Action": [
"secretsmanager:GetSecretValue"
]
}
]
}
Expand Down

0 comments on commit 709f409

Please sign in to comment.