From 5428073f4e8fada0235dda88327fe8698e4ef1fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:25:21 +0200 Subject: [PATCH 1/7] Whitespace fixes to Dockerfile --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28a0f90..9b3e4a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,18 +83,17 @@ RUN ./configure CFLAGS="-ggdb"\ --with-libxslt\ --with-icu\ --with-openssl - + RUN make DESTDIR=${BABELFISH_HOME}/ -j ${JOBS} 2>error.txt && make install WORKDIR ${PG_SRC}/contrib - RUN make -j ${JOBS} && make install # Compile the ANTLR parser generator RUN cp /usr/local/lib/libantlr4-runtime.so.${ANTLR4_VERSION}\ ${BABELFISH_HOME}/lib - -WORKDIR ${PG_SRC}/contrib/babelfishpg_tsql/antlr + +WORKDIR ${PG_SRC}/contrib/babelfishpg_tsql/antlr RUN cmake -Wno-dev . RUN make all From 2607a42ef15a4c37fa1c571e0df298921e2d7d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:34:01 +0200 Subject: [PATCH 2/7] Setup .gitignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a09c56d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea From 4a0be7922fe237e810dc6396734aa9a115074107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:25:59 +0200 Subject: [PATCH 3/7] Do not set DEBIAN_FRONTEND=noninteractive for final image --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9b3e4a3..f70c365 100644 --- a/Dockerfile +++ b/Dockerfile @@ -112,7 +112,6 @@ RUN make -j ${JOBS} && make PG_CONFIG=${PG_CONFIG} install # Run stage FROM base AS runner -ENV DEBIAN_FRONTEND=noninteractive ENV BABELFISH_HOME=/opt/babelfish ENV POSTGRES_USER_HOME=/var/lib/babelfish @@ -121,7 +120,8 @@ WORKDIR ${BABELFISH_HOME} COPY --from=builder ${BABELFISH_HOME} . # Install runtime dependencies -RUN apt update && apt install -y --no-install-recommends\ +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt update && apt install -y --no-install-recommends\ libssl3 openssl libldap-2.5-0 libxml2 libpam0g uuid libossp-uuid16\ libxslt1.1 libicu70 libpq5 unixodbc From 7e535a72ca11ce7830afead2a1eb3f639a9a8775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:29:52 +0200 Subject: [PATCH 4/7] Set EXPOSE and ENTRYPOINT early --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f70c365..6033083 100644 --- a/Dockerfile +++ b/Dockerfile @@ -114,6 +114,8 @@ RUN make -j ${JOBS} && make PG_CONFIG=${PG_CONFIG} install FROM base AS runner ENV BABELFISH_HOME=/opt/babelfish ENV POSTGRES_USER_HOME=/var/lib/babelfish +EXPOSE 1433 5432 +ENTRYPOINT [ "/start.sh" ] # Copy binaries to run stage WORKDIR ${BABELFISH_HOME} @@ -138,9 +140,5 @@ RUN chown -R postgres ${POSTGRES_USER_HOME} # Change to postgres user USER postgres -# Expose ports -EXPOSE 1433 5432 - # Set entry point COPY start.sh / -ENTRYPOINT [ "/start.sh" ] From bf6f240235db8b51e42f9732f6e9452002c6b49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:33:23 +0200 Subject: [PATCH 5/7] Run adduser early --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6033083..a6b8cc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -127,16 +127,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ libssl3 openssl libldap-2.5-0 libxml2 libpam0g uuid libossp-uuid16\ libxslt1.1 libicu70 libpq5 unixodbc +RUN adduser postgres --home ${POSTGRES_USER_HOME} + # Enable data volume ENV BABELFISH_DATA=${POSTGRES_USER_HOME}/data RUN mkdir -p ${BABELFISH_DATA} VOLUME ${BABELFISH_DATA} -# Create postgres user -RUN adduser postgres --home ${POSTGRES_USER_HOME} -RUN chown -R postgres ${BABELFISH_HOME} -RUN chown -R postgres ${POSTGRES_USER_HOME} - # Change to postgres user USER postgres From 0b8abafa0df29f54ea09a5308f830c2a881be939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:32:22 +0200 Subject: [PATCH 6/7] Run mkdir and chown in one step --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a6b8cc3..fef093f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -131,7 +131,7 @@ RUN adduser postgres --home ${POSTGRES_USER_HOME} # Enable data volume ENV BABELFISH_DATA=${POSTGRES_USER_HOME}/data -RUN mkdir -p ${BABELFISH_DATA} +RUN install -d -o postgres -g postgres ${BABELFISH_DATA} VOLUME ${BABELFISH_DATA} # Change to postgres user From 4d729da19bc58b9d86ebb9a3a5c940db6e5baaa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 25 Mar 2026 18:34:55 +0200 Subject: [PATCH 7/7] Copy binaries after apt install --- Dockerfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index fef093f..7b669a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -117,10 +117,6 @@ ENV POSTGRES_USER_HOME=/var/lib/babelfish EXPOSE 1433 5432 ENTRYPOINT [ "/start.sh" ] -# Copy binaries to run stage -WORKDIR ${BABELFISH_HOME} -COPY --from=builder ${BABELFISH_HOME} . - # Install runtime dependencies RUN export DEBIAN_FRONTEND=noninteractive && \ apt update && apt install -y --no-install-recommends\ @@ -129,13 +125,15 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ RUN adduser postgres --home ${POSTGRES_USER_HOME} +# Copy binaries to run stage +COPY --chmod=755 start.sh / +WORKDIR ${BABELFISH_HOME} +COPY --from=builder --chown=postgres ${BABELFISH_HOME} . + # Enable data volume ENV BABELFISH_DATA=${POSTGRES_USER_HOME}/data RUN install -d -o postgres -g postgres ${BABELFISH_DATA} VOLUME ${BABELFISH_DATA} -# Change to postgres user +# Switch runtime user in container USER postgres - -# Set entry point -COPY start.sh /