Combine tag and push commands

This commit is contained in:
chuckcharlie
2022-08-19 09:32:24 -06:00
committed by GitHub
parent d5eb27e126
commit 9cdce52612

View File

@@ -5,10 +5,6 @@ env:
secrets-manager: secrets-manager:
DOCKERHUB_PASS: "/dockerhub/credentials:password" DOCKERHUB_PASS: "/dockerhub/credentials:password"
DOCKERHUB_USERNAME: "/dockerhub/credentials:username" DOCKERHUB_USERNAME: "/dockerhub/credentials:username"
# variables:
# VERSION: $(cat version.txt)
# exported-variables:
# - VERSION
phases: phases:
install: install:
commands: commands:
@@ -22,10 +18,9 @@ phases:
- echo Build started on `date` - echo Build started on `date`
- echo Building the Docker image... - echo Building the Docker image...
- VERSION=$(cat version.txt) - VERSION=$(cat version.txt)
- docker build -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION . - docker build -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$IMAGE_TAG .
- docker tag $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$IMAGE_TAG
post_build: post_build:
commands: commands:
- echo Build completed on `date` - echo Build completed on `date`
- echo Pushing the Docker image... - 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