Skip to content

Commit b2bf51c

Browse files
simplify buildspecs
1 parent 3b8c1d5 commit b2bf51c

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

buildspec/merge_master.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ phases:
44
commands:
55
- export DOCKER_BUILDKIT=1
66
- export ECR_ACCOUNT_ID="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f1)"
7-
- export ECR_REGION="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f4)"
8-
build:
9-
commands:
107
- echo Logging in to Amazon ECR...
118
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
9+
build:
10+
commands:
1211
- echo Building the Docker image...
13-
- docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --build-arg ECR_REGION=${ECR_REGION} -t ${FIPS_REPOSITORY_URI}:latest .
12+
- docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} -t ${FIPS_REPOSITORY_URI}:latest .
1413
- docker image push --all-tags ${FIPS_REPOSITORY_URI}
1514
post_build:
1615
commands:

buildspec/push.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ phases:
44
commands:
55
- export DOCKER_BUILDKIT=1
66
- export ECR_ACCOUNT_ID="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f1)"
7-
- export ECR_REGION="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f4)"
8-
build:
9-
commands:
107
- echo Logging in to Amazon ECR...
118
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
9+
build:
10+
commands:
1211
- export COMMIT_HASH_SHORT="$(echo $COMMIT_HASH | cut -c 1-7)"
1312
- echo Building the Docker image...
1413
- echo $COMMIT_HASH_SHORT
1514
- echo $BRANCH_NAME
16-
- docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --build-arg ECR_REGION=${ECR_REGION} --tag ${FIPS_REPOSITORY_URI}:${COMMIT_HASH_SHORT} --tag ${FIPS_REPOSITORY_URI}:${BRANCH_NAME} .
15+
- docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --tag ${FIPS_REPOSITORY_URI}:${COMMIT_HASH_SHORT} --tag ${FIPS_REPOSITORY_URI}:${BRANCH_NAME} .
1716
- docker image push --all-tags ${FIPS_REPOSITORY_URI}
1817
post_build:
1918
commands:

buildspec/release.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ phases:
55
commands:
66
- export DOCKER_BUILDKIT=1
77
- export ECR_ACCOUNT_ID="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f1)"
8-
- export ECR_REGION="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f4)"
9-
build:
10-
commands:
118
- echo Logging in to Amazon ECR...
129
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
10+
build:
11+
commands:
1312
- PATCH_TAG=${TAG_NAME#"v"}
1413
- MINOR_TAG=${PATCH_TAG%.*}
1514
- MAJOR_TAG=${MINOR_TAG%.*}
16-
- docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --build-arg ECR_REGION=${ECR_REGION} -t ${FIPS_REPOSITORY_URI}:${PATCH_TAG} -t ${FIPS_REPOSITORY_URI}:${MINOR_TAG} -t ${FIPS_REPOSITORY_URI}:${MAJOR_TAG} .
15+
- docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} -t ${FIPS_REPOSITORY_URI}:${PATCH_TAG} -t ${FIPS_REPOSITORY_URI}:${MINOR_TAG} -t ${FIPS_REPOSITORY_URI}:${MAJOR_TAG} .
1716
- docker image push --all-tags ${FIPS_REPOSITORY_URI}
1817
post_build:
1918
commands:

0 commit comments

Comments
 (0)