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
How do i use the image from the previous step. [?]
Via the registry.
The underlying problem you most likely run into with the design how you deploy the images is that you make use of the `latest` tag which is prone to side-effects that are that harsh that you can't (with your current setup/design) deploy the same (container image build) revision first to dev, then test and then prod.
But I might misread your pipeline to some extend, as I can't see how the deployment to different environments there work already. If the image push to aws ecr is the deployment already then I can't see how this are actually different environments (here: dev, test and prod).
Maybe you can add a bit more context if your problem is more with creating the images, more with pushing them or more with deploying them to the different dev, test and prod environments and give a bit more description.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.