2021-02-25 16:36:10 +00:00
|
|
|
# Template docker-push
|
|
|
|
# Prerequisites: $DOCKERHUB_USERNAME, $DOCKERHUB_PASSWORD setup as deployment variables
|
|
|
|
|
|
|
|
image: atlassian/default-image:2
|
|
|
|
|
|
|
|
pipelines:
|
|
|
|
default:
|
|
|
|
- parallel:
|
|
|
|
- step:
|
2021-02-25 17:20:47 +00:00
|
|
|
name: Parallel Build and Test
|
2021-02-25 16:36:10 +00:00
|
|
|
script:
|
|
|
|
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
|
2021-02-25 17:56:35 +00:00
|
|
|
- docker build . --file Dockerfile --tag "gmgauthier/${IMAGE_NAME}:latest"
|
2021-02-25 16:36:10 +00:00
|
|
|
services:
|
|
|
|
- docker
|
|
|
|
caches:
|
2021-02-25 18:02:10 +00:00
|
|
|
- docker
|
2021-02-25 17:38:05 +00:00
|
|
|
|
2021-02-25 16:36:10 +00:00
|
|
|
branches:
|
|
|
|
master:
|
|
|
|
- step:
|
2021-02-25 17:20:47 +00:00
|
|
|
name: Master Build and Test
|
2021-02-25 16:36:10 +00:00
|
|
|
script:
|
|
|
|
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
|
2021-02-25 17:56:35 +00:00
|
|
|
- docker build . --file Dockerfile --tag "gmgauthier/${IMAGE_NAME}"
|
2021-02-25 16:36:10 +00:00
|
|
|
- docker save ${IMAGE_NAME} --output "${IMAGE_NAME}.tar"
|
|
|
|
services:
|
|
|
|
- docker
|
|
|
|
caches:
|
|
|
|
- docker
|
|
|
|
artifacts:
|
|
|
|
- "*.tar"
|
|
|
|
- step:
|
|
|
|
name: Deploy to Production
|
|
|
|
deployment: Production
|
|
|
|
script:
|
|
|
|
- echo ${DOCKERHUB_PASSWORD} | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
|
|
|
|
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
|
2021-02-25 17:56:35 +00:00
|
|
|
- docker push "gmgauthier/${IMAGE_NAME}:latest"
|
2021-02-25 16:36:10 +00:00
|
|
|
services:
|
|
|
|
- docker
|