StackStorm/st2-dockerfiles

DOCKER_TAG not used by Dockerfiles

ytjohn opened this issue · 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.

arm4b commented

That makes sense and looks like fairly minimal change so I'm 👍

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.

winem commented

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

arm4b commented

WDYT @ytjohn?