Multistage Dockerfile

Hi,
is it possible to create a multistage docker file where kong-migration is also included? Something like this:

ARG KONG_VERSION=3.6.1

FROM kong:${KONG_VERSION}-ubuntu as kong
USER root
RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y git luarocks curl wget unzip \
    && rm -rf /var/lib/apt/lists/*

# Custom Plugins
ADD /config/kong.conf /etc/kong/kong.conf

HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD http://localhost:8007/status/ready || exit 1


FROM kong as kong-migrations
ENTRYPOINT ["kong", "migrations", "bootstrap", "--conf", "/etc/kong/kong.conf"]

Best reagrds,
Ritika

Hi ritika

I’m not sure this is the best approach, particularly o K8s, because running a migration process concurrently is not recommanded (ref. Race condition(?) when running clustered in Kubernetes · Issue #2125 · Kong/kong · GitHub)

Best regards,
Denis