@@ -83,18 +83,17 @@ RUN ./configure CFLAGS="-ggdb"\
8383 --with-libxslt\
8484 --with-icu\
8585 --with-openssl
86-
86+
8787RUN make DESTDIR=${BABELFISH_HOME}/ -j ${JOBS} 2>error.txt && make install
8888
8989WORKDIR ${PG_SRC}/contrib
90-
9190RUN make -j ${JOBS} && make install
9291
9392# Compile the ANTLR parser generator
9493RUN cp /usr/local/lib/libantlr4-runtime.so.${ANTLR4_VERSION}\
9594 ${BABELFISH_HOME}/lib
96-
97- WORKDIR ${PG_SRC}/contrib/babelfishpg_tsql/antlr
95+
96+ WORKDIR ${PG_SRC}/contrib/babelfishpg_tsql/antlr
9897RUN cmake -Wno-dev .
9998RUN make all
10099
@@ -113,35 +112,28 @@ RUN make -j ${JOBS} && make PG_CONFIG=${PG_CONFIG} install
113112
114113# Run stage
115114FROM base AS runner
116- ENV DEBIAN_FRONTEND=noninteractive
117115ENV BABELFISH_HOME=/opt/babelfish
118116ENV POSTGRES_USER_HOME=/var/lib/babelfish
119-
120- # Copy binaries to run stage
121- WORKDIR ${BABELFISH_HOME}
122- COPY --from=builder ${BABELFISH_HOME} .
117+ EXPOSE 1433 5432
118+ ENTRYPOINT [ "/start.sh" ]
123119
124120# Install runtime dependencies
125- RUN apt update && apt install -y --no-install-recommends\
121+ RUN export DEBIAN_FRONTEND=noninteractive && \
122+ apt update && apt install -y --no-install-recommends\
126123 libssl3 openssl libldap-2.5-0 libxml2 libpam0g uuid libossp-uuid16\
127124 libxslt1.1 libicu70 libpq5 unixodbc
128125
126+ RUN adduser postgres --home ${POSTGRES_USER_HOME}
127+
128+ # Copy binaries to run stage
129+ COPY --chmod=755 start.sh /
130+ WORKDIR ${BABELFISH_HOME}
131+ COPY --from=builder --chown=postgres ${BABELFISH_HOME} .
132+
129133# Enable data volume
130134ENV BABELFISH_DATA=${POSTGRES_USER_HOME}/data
131- RUN mkdir -p ${BABELFISH_DATA}
135+ RUN install -d -o postgres -g postgres ${BABELFISH_DATA}
132136VOLUME ${BABELFISH_DATA}
133137
134- # Create postgres user
135- RUN adduser postgres --home ${POSTGRES_USER_HOME}
136- RUN chown -R postgres ${BABELFISH_HOME}
137- RUN chown -R postgres ${POSTGRES_USER_HOME}
138-
139- # Change to postgres user
138+ # Switch runtime user in container
140139USER postgres
141-
142- # Expose ports
143- EXPOSE 1433 5432
144-
145- # Set entry point
146- COPY start.sh /
147- ENTRYPOINT [ "/start.sh" ]
0 commit comments