st2-dockerfiles icon indicating copy to clipboard operation
st2-dockerfiles copied to clipboard

DOCKER_TAG not used by Dockerfiles

Open ytjohn opened this issue 4 years ago • 3 comments

I can do a PR, but wanted to ask this as a question first. I want to build a custom st2 base image and then build the remaining st2 images from that image instead of upstream stackstorm/st2:${ST2_VERSION}

For background, I went to build the docker images myself in order to get bionic/python3.6 (see #16), which required making changes to the base image. I want to give the st2 base image and all subsequent ones a tag of "3.2.0-dev-bionic", which I can do by exporting DOCKER_TAG before running "make build".

The problem is that each Dockerfile has a line of FROM stackstorm/st2:${ST2_VERSION}. Which means they won't build from my new base image, but rather upstream base image.

My workaround is to additionally pass DOCKER_TAG into each Dockerfile and update the from line.

ARG ST2_VERSION
ARG DOCKER_TAG
FROM stackstorm/st2:${DOCKER_TAG}

Then in the Makefile:

        for component in st2*; do \
                docker build \
                        --no-cache \
                        --build-arg ST2_VERSION=${ST2_VERSION} \
                        --build-arg DOCKER_TAG=${DOCKER_TAG} \
                        --tag stackstorm/$$component:${DOCKER_TAG} \

This seems reasonable to me. If someone is needing to put a specific tag on the base, they will most likely want to build their other images from that tag. If this seems reasonable or useful to others, I will go ahead and create a PR.

ytjohn avatar Apr 30 '20 11:04 ytjohn

That makes sense and looks like fairly minimal change so I'm :+1:

BTW we're going to switch to Ubuntu Bionic for the Dockerfiles really soon. So your tests and feedback in #16 would be very helpful.

arm4b avatar Apr 30 '20 11:04 arm4b

Can't this be closed as the PR was already merged? Or is there any remaining ToDo?

winem avatar May 23 '20 20:05 winem

WDYT @ytjohn?

arm4b avatar May 23 '20 20:05 arm4b