How could we parse data between two docker containers in two TeamCity build steps

Viewed 26

I am working on building two docker containers in different steps in TeamCity. My aim is: Build two docker images in two steps of TeamCity, the data created in docker image 1 will be parsed into docker image 2.

Build step 1 in TeamCity: Create the docker container 1 and run the docker to create 3 files

FROM python:3.8-slim-buster

WORKDIR /app

VOLUME ["/data"]

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

ENTRYPOINT [ "python", "-u", "./create_files.py" ]

Build Step 2 in TeamCity: Build docker container 2 and use the created 3 files from above docker container 1.

FROM python:3.8-slim-buster

WORKDIR /app

VOLUME ["/data"]

ENTRYPOINT [ "python", "-u", "./use_files.py" ]

How could we parse the output of the first docker image (container1) to 2nd docker image (container2)? From the documentation, it seems VOLUME could be used to share files between different containers in one VM? But in my case, I need create docker image1 in step1 in TeamCity and docker image2 in step2 in TeamCity, it will be different VMs.

Or the alternative solution is to upload the created 3 files in docker image1 to Google cloud or somewhere else, then in docker image2 I need download the 3 files and use it?

0 Answers
Related