bitbucket-pipelines.yml edited online with Bitbucket

This commit is contained in:
Greg Gauthier 2021-02-25 17:38:05 +00:00
parent 53afdf873c
commit e2b88bcf9e

View File

@ -1,9 +1,4 @@
# Template docker-push
# This template allows you to build and push your docker image to a Docker Hub account.
# The workflow allows running tests, code linting and security scans on feature branches (as well as master).
# The docker image will be validated and pushed to the docker registry after the code is merged to master.
# Prerequisites: $DOCKERHUB_USERNAME, $DOCKERHUB_PASSWORD setup as deployment variables
image: atlassian/default-image:2
@ -20,18 +15,14 @@ pipelines:
- docker
caches:
- docker
- step:
name: Lint the Dockerfile
image: hadolint/hadolint:latest-debian
script:
- hadolint Dockerfile
branches:
master:
- step:
name: Master Build and Test
script:
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
- docker build . --file Dockerfile --tag gmgauthier/${IMAGE_NAME}
- docker build . --file Dockerfile --tag ${DOCKERHUB_NAMESPACE}/${IMAGE_NAME}
- docker save ${IMAGE_NAME} --output "${IMAGE_NAME}.tar"
services:
- docker
@ -45,6 +36,6 @@ pipelines:
script:
- echo ${DOCKERHUB_PASSWORD} | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
- docker push gmgauthier/${IMAGE_NAME}:latest
- docker push ${DOCKERHUB_NAMESPACE}/${IMAGE_NAME}:latest
services:
- docker