python-service-1/bitbucket-pipelines.yml

42 lines
1.2 KiB
YAML
Raw Normal View History

# Template docker-push
# Prerequisites: $DOCKERHUB_USERNAME, $DOCKERHUB_PASSWORD setup as deployment variables
image: atlassian/default-image:2
pipelines:
default:
- parallel:
- step:
name: Parallel Build and Test
script:
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
- docker build . --file Dockerfile --tag "gmgauthier/${IMAGE_NAME}:latest"
services:
- docker
caches:
- docker
branches:
master:
- step:
name: Master Build and Test
script:
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
- docker build . --file Dockerfile --tag "gmgauthier/${IMAGE_NAME}"
- 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
- docker push "gmgauthier/${IMAGE_NAME}:latest"
services:
- docker