From 9cdce526122a441664f46c9de53e41e55e4d99d9 Mon Sep 17 00:00:00 2001 From: chuckcharlie Date: Fri, 19 Aug 2022 09:32:24 -0600 Subject: [PATCH] Combine tag and push commands --- buildspec.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index 60fc1d4..3db99dd 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -5,10 +5,6 @@ env: secrets-manager: DOCKERHUB_PASS: "/dockerhub/credentials:password" DOCKERHUB_USERNAME: "/dockerhub/credentials:username" -# variables: -# VERSION: $(cat version.txt) -# exported-variables: -# - VERSION phases: install: commands: @@ -22,10 +18,9 @@ phases: - echo Build started on `date` - echo Building the Docker image... - VERSION=$(cat version.txt) - - docker build -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION . - - docker tag $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$IMAGE_TAG + - docker build -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$IMAGE_TAG . post_build: commands: - echo Build completed on `date` - echo Pushing the Docker image... - - docker push $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$IMAGE_TAG + - docker push $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME --all-tags