Trying to build a BitBucket pipeline file to only build once and then push that build to different environments manually. but right now as i see it builds in each step and pushes. How do i use the image from the previous step.
pipelines:
custom:
buildDeploy:
- step:
name: Build Keycloak Docker Image and Upload Dev
services:
- docker
deployment: dev
script:
- ls -ahl
- docker build -t keycloak .
- pipe: atlassian/aws-ecr-push-image:1.2.0
variables:
IMAGE_NAME: keycloak
TAGS: 'latest'
- step:
name: Build Keycloak Docker Image and Upload Demo
services:
- docker
deployment: demo
trigger: manual
script:
- ls -ahl
- docker build -t keycloak .
- pipe: atlassian/aws-ecr-push-image:1.2.0
variables:
IMAGE_NAME: keycloak
TAGS: 'latest'
- step:
name: Build Keycloak Docker Image and Upload Prod
services:
- docker
deployment: Prod
trigger: manual
script:
- ls -ahl
- docker build -t keycloak .
- pipe: atlassian/aws-ecr-push-image:1.2.0
variables:
IMAGE_NAME: keycloak
TAGS: 'latest'
options:
docker: true