This commit is contained in:
2024-12-04 21:17:59 +03:00
parent dea7d7cd0e
commit c7ff1d2b5c
14 changed files with 273 additions and 272 deletions

View File

@@ -41,6 +41,12 @@ RUN d="@$(date '+%s')" ; \
find /usr/local/lib/ -name '*.pyc' -exec touch -m -d "$d" {} + ; \
find /usr/local/lib/ -name __pycache__ -exec touch -m -d "$d" {} +
WORKDIR /pycache
RUN find /usr/local/ -type f -name '*.py[co]' -printf '%P\0' \
| sort -zV \
| tar -C /usr/local --null -T - -cf - \
| tar -xf -
## ---
FROM deps AS postgresql
@@ -66,7 +72,7 @@ RUN sed "s/%{PG_MAJOR}/${PG_MAJOR}/g" < /tmp/pgdg-ver.sources > "/etc/apt/source
sed "s/%{PG_MAJOR}/${PG_MAJOR}/g" < /tmp/pgdg-ver.prefs > "/etc/apt/preferences.d/pgdg-${PG_MAJOR}" ; \
rm -f /tmp/pgdg-ver.sources /tmp/pgdg-ver.prefs
COPY --from=postgresql-upstream /etc/postgresql-common/createcluster.conf /etc/postgresql-common/
COPY --from=postgresql-upstream /etc/postgresql-common/createcluster.conf /etc/postgresql-common/
RUN apt-install.sh postgresql-common ; \
apt-install.sh \
"postgresql-${PG_MAJOR}" \
@@ -75,12 +81,12 @@ RUN apt-install.sh postgresql-common ; \
f="/usr/share/postgresql/${PG_MAJOR}/postgresql.conf.sample" ; \
dpkg-divert --add --rename --divert "$f.dpkg" "$f" ; \
ln -sv ../postgresql.conf.sample "/usr/share/postgresql/${PG_MAJOR}/"
COPY --from=postgresql-upstream /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/
COPY --from=postgresql-upstream /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/
ENV PATH=${PATH}:/usr/lib/postgresql/${PG_MAJOR}/bin
COPY --from=postgresql-upstream /docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
COPY --from=postgresql-upstream /usr/local/bin/*.sh /usr/local/bin/
COPY --from=postgresql-upstream /docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
COPY --from=postgresql-upstream /usr/local/bin/*.sh /usr/local/bin/
## compatibility ;)
RUN ln -sv /usr/local/sbin/dumb-run-as.sh /usr/local/bin/gosu
@@ -122,7 +128,8 @@ RUN apt-install.sh \
"postgresql-${PG_MAJOR}-unit" \
"postgresql-${PG_MAJOR}-wal2json" \
; \
apt-clean.sh
apt-clean.sh ; \
jdupes -1LSpr /usr/
## ---
@@ -134,7 +141,8 @@ COPY /apt/sources.citus /etc/apt/sources.list.d/citus.sources
RUN apt-install.sh \
"postgresql-${PG_MAJOR}-citus-12.1" \
"postgresql-${PG_MAJOR}-topn" \
; apt-clean.sh
; apt-clean.sh ; \
jdupes -1LSpr /usr/
VOLUME [ "${PGHOME}" ]
@@ -146,8 +154,7 @@ SHELL [ "/bin/sh", "-ec" ]
COPY /Dockerfile /usr/local/share/
## RFC: Python cache
## TODO: reduce load by selecting only __pycache__ directories in either way
COPY --from=pycache /usr/local/lib/ /usr/local/lib/
COPY --from=pycache /pycache/ /usr/local/
COPY /ep.sh /usr/local/sbin/
COPY /postgres-shim.sh /usr/local/sbin/