Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using build files from docker container in other pipeline steps

James Wolensky
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 30, 2022

In the first step in my pipeline, I am building my application with docker and deploying it to AWS ECR. However, in a follow up step, I would like to use those same build files I uploaded to AWS for a shell script. They need to be the same files I uploaded because each `npm run build` creates different hashed file names. How can I export the build folder from step 1 to use in future pipeline steps?

 

- step: &build-staging
name: Build and publish docker image
services:
- docker
caches:
- docker
script:
- docker build -t web . #/dist folder gets created and uploaded to AWS
- pipe: atlassian/aws-ecr-push-image:1.4.2

- step: &upload-source-maps-staging
name: Upload source maps
script:
- npm ci
- /bin/bash upload-source-maps.sh #I want to use the /dist folder created in the build-staging step above

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 1, 2022

Hi James and welcome to the community!

If the dist folder is created in the clone directory, then you can define it as an artifact so that its contents become available for the next step. You can do this the following way:

- step: &build-staging
name: Build and publish docker image
services:
- docker
caches:
- docker
script:
- docker build -t web . #/dist folder gets created and uploaded to AWS
- pipe: atlassian/aws-ecr-push-image:1.4.2
artifacts:
- dist/**

You can check the following documentation page for more info:

Keep in mind that the step that generates the artifact and the steps that use it cannot be parallel steps.

Please feel free to let me know how it goes and if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events