Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: xieydd <[email protected]>
  • Loading branch information
xieydd committed Nov 13, 2024
1 parent 4b8b651 commit 571d230
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
10 changes: 2 additions & 8 deletions docker/pg-cnpg/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,9 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Test trunk
COPY trunk-install.sh /usr/local/bin/

RUN set -eux; \
mkdir /tmp/pg_pkglibdir; \
mkdir /tmp/pg_sharedir; \
cp -r $(pg_config --pkglibdir)/* /tmp/pg_pkglibdir; \
cp -r $(pg_config --sharedir)/* /tmp/pg_sharedir

# Change the uid of postgres to 26
RUN usermod -u 26 postgres
RUN chown -R postgres:postgres ${ALTDIR}/${PG_MAJOR}
RUN cp /usr/share/postgresql/${PG_MAJOR}/extension/* ${ALTDIR}/${PG_MAJOR}/share/extension/
RUN cp /usr/share/postgresql/${PG_MAJOR}/extension/* ${ALTDIR}/extension/
USER 26
ENV PATH $PATH:${ALTDIR}/${PG_MAJOR}/bin
ENV PATH $PATH:/usr/lib/postgresql/${PG_MAJOR}/bin
39 changes: 19 additions & 20 deletions docker/pg-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ARG DEBIAN_FRONTEND=noninteractive
ARG ALTDIR=/var/lib/postgresql/data/tensorchord
ENV TZ=Etc/UTC
ENV PGDATA /var/lib/postgresql/data
ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin

# Get latest package updates
RUN set -eux; \
Expand Down Expand Up @@ -112,29 +111,29 @@ WORKDIR /
RUN rm -rf /postgres

RUN mkdir -p /var/run/postgresql && chmod 775 /var/run/postgresql
# RUN mkdir -p /usr/share/postgresql/${PG_MAJOR}/extension && chmod 775 /usr/share/postgresql/${PG_MAJOR}/extension
RUN mkdir -p /usr/share/postgresql/${PG_MAJOR}/extension && chmod 775 /usr/share/postgresql/${PG_MAJOR}/extension

# COPY --from=tianon/gosu /gosu /usr/local/bin/
COPY --from=tianon/gosu /gosu /usr/local/bin/

# # make the sample config easier to munge (and "correct by default")
# RUN set -eux; \
# echo "unix_socket_directories = '/var/run/postgresql'" >> ${ALTDIR}/postgresql.conf.sample; \
# sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" ${ALTDIR}/postgresql.conf.sample; \
# grep -F "listen_addresses = '*'" ${ALTDIR}/postgresql.conf.sample
# make the sample config easier to munge (and "correct by default")
RUN set -eux; \
echo "unix_socket_directories = '/var/run/postgresql'" >> ${ALTDIR}/postgresql.conf.sample; \
sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" ${ALTDIR}/postgresql.conf.sample; \
grep -F "listen_addresses = '*'" ${ALTDIR}/postgresql.conf.sample

# RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql

# # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
# RUN install --verbose --directory --owner postgres --group postgres --mode 1777 ${PGDATA}
# this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
RUN install --verbose --directory --owner postgres --group postgres --mode 1777 ${PGDATA}

# ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin:/usr/local/bin
# COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
# RUN ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
# ENTRYPOINT ["docker-entrypoint.sh"]
ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin:/usr/local/bin
COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
RUN ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
ENTRYPOINT ["docker-entrypoint.sh"]

# # Remove pre-installed pg_config
# RUN rm /usr/bin/pg_config
# Remove pre-installed pg_config
RUN rm /usr/bin/pg_config

# STOPSIGNAL SIGINT
# EXPOSE 5432
# CMD ["postgres"]
STOPSIGNAL SIGINT
EXPOSE 5432
CMD ["postgres"]

0 comments on commit 571d230

Please sign in to comment.