<p>I want to create dataBase for autotest in kubernetes. I want to create an  image(postg-my-app-v1) from postgres image, add changelog files, and liquibase image. When I deploy this image with helm i just want to specify containers - postg-my-app-v1 and it should startup pod with database and create tables with liquibase changelog.</p>
<p>Now i create Dockerfile as below</p>
<pre><code>FROM postgres
ADD /changelog /liquibase/changelog
</code></pre>
<p>I don't understand how to add liquibase to this image? Or i must use docker compose? or helm lifecycle postStart for liquibase?</p>

Tim
<pre><code>FROM docker-proxy.tcsbank.ru/liquibase/liquibase:3.10.x AS Liquibase

FROM docker-proxy.tcsbank.ru/postgres:9.6.12 AS Postgres
ENV POSTGRES_DB bpm
ENV POSTGRES_USER priest
ENV POSTGRES_PASSWORD Bpm_123


COPY --from=Liquibase /liquibase /liquibase

ENV JAVA_HOME /usr/local/openjdk-11
COPY --from=Liquibase $JAVA_HOME $JAVA_HOME


ENV LIQUIBASE_CHANGELOG /liquibase/changelog/
COPY /changelog $LIQUIBASE_CHANGELOG


COPY liquibase.sh /usr/local/bin/
COPY main.sh /usr/local/bin/

RUN chmod +x /usr/local/bin/liquibase.sh &amp;&amp; \
    chmod +x /usr/local/bin/main.sh &amp;&amp; \
    ln -s /usr/local/bin/main.sh / &amp;&amp; \
    ln -s /usr/local/bin/liquibase.sh /

ENTRYPOINT [&quot;main.sh&quot;]
</code></pre>
<p>main.sh</p>
<pre><code>#!/bin/bash

bash liquibase.sh | awk '{print &quot;liquiBase script: &quot; $0}' &amp;

bash docker-entrypoint.sh postgres
</code></pre>
<p>liquibase.sh</p>
<pre><code>#!/bin/bash

for COUNTER in {1..120}
do
   sleep 1s
   echo &quot;check db $COUNTER times&quot;
   pg_isready
   if [ $? -eq 0 ]
   then
     break
   fi
done

echo &quot;try execute liquibase&quot;
bash liquibase/liquibase --url=&quot;jdbc:postgresql://localhost:5432/$POSTGRES_DB&quot;  --username=$POSTGRES_USER --password=$POSTGRES_PASSWORD --changeLogFile=/liquibase/changelog/changelog.xml update
</code></pre>
