Compare commits
6 Commits
20182ec83f
...
8b83963828
Author | SHA1 | Date | |
---|---|---|---|
8b83963828
|
|||
6f32deea79
|
|||
2bd64c4c32
|
|||
b259b17704
|
|||
f0d9f41a3d
|
|||
d8c7de04a5
|
54
Dockerfile
54
Dockerfile
@@ -5,50 +5,6 @@ FROM ${DEPS_IMAGE} AS deps
|
|||||||
|
|
||||||
## ---
|
## ---
|
||||||
|
|
||||||
FROM deps AS pycache
|
|
||||||
SHELL [ "/bin/sh", "-ec" ]
|
|
||||||
|
|
||||||
COPY /scripts/* /usr/local/sbin/
|
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=''
|
|
||||||
|
|
||||||
## Python cache preseed
|
|
||||||
|
|
||||||
RUN libpython="${PYTHON_SITE_PACKAGES%/*}" ; \
|
|
||||||
find "${libpython}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
|
||||||
| sed -zEn \
|
|
||||||
-e '/^(collections|importlib|json|re)$/p' \
|
|
||||||
| sort -zV \
|
|
||||||
| env -C "${libpython}" xargs -0r \
|
|
||||||
python3 -m compileall -q -j 2 ; \
|
|
||||||
find "${PYTHON_SITE_PACKAGES}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
|
||||||
| sed -zE \
|
|
||||||
-e '/\.(dist-info|pth|txt)$/d' \
|
|
||||||
-e '/^(pip|pkg_resources|setuptools|wheel)$/d' \
|
|
||||||
| sort -zV \
|
|
||||||
| env -C "${PYTHON_SITE_PACKAGES}" xargs -0r \
|
|
||||||
python3 -m compileall -q -j 2
|
|
||||||
|
|
||||||
## Python cache warmup
|
|
||||||
RUN export PYTHONPROFILEIMPORTTIME=1 ; \
|
|
||||||
patronictl --help ; \
|
|
||||||
patroni --help ; \
|
|
||||||
ydiff --help ; \
|
|
||||||
cdiff --help
|
|
||||||
|
|
||||||
## Python cache adjustments
|
|
||||||
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
|
FROM deps AS postgresql
|
||||||
SHELL [ "/bin/sh", "-ec" ]
|
SHELL [ "/bin/sh", "-ec" ]
|
||||||
|
|
||||||
@@ -138,8 +94,11 @@ SHELL [ "/bin/sh", "-ec" ]
|
|||||||
|
|
||||||
COPY /apt/sources.citus /etc/apt/sources.list.d/citus.sources
|
COPY /apt/sources.citus /etc/apt/sources.list.d/citus.sources
|
||||||
|
|
||||||
RUN apt-install.sh \
|
RUN apt-env.sh apt-get update ; \
|
||||||
"postgresql-${PG_MAJOR}-citus-12.1" \
|
citus_pkg=$(apt-cache search "^postgresql-${PG_MAJOR}-citus-[0-9.]+\$" | awk '{print $1}' | sort -rV | head -n1) ; \
|
||||||
|
: "${citus_pkg:?}" ; \
|
||||||
|
apt-install.sh \
|
||||||
|
"${citus_pkg}" \
|
||||||
"postgresql-${PG_MAJOR}-topn" \
|
"postgresql-${PG_MAJOR}-topn" \
|
||||||
; apt-clean.sh ; \
|
; apt-clean.sh ; \
|
||||||
jdupes -1LSpr /usr/
|
jdupes -1LSpr /usr/
|
||||||
@@ -153,9 +112,6 @@ SHELL [ "/bin/sh", "-ec" ]
|
|||||||
|
|
||||||
COPY /Dockerfile /usr/local/share/
|
COPY /Dockerfile /usr/local/share/
|
||||||
|
|
||||||
## RFC: Python cache
|
|
||||||
COPY --from=pycache /pycache/ /usr/local/
|
|
||||||
|
|
||||||
COPY /ep.sh /usr/local/sbin/
|
COPY /ep.sh /usr/local/sbin/
|
||||||
COPY /postgres-shim.sh /usr/local/sbin/
|
COPY /postgres-shim.sh /usr/local/sbin/
|
||||||
## quirk
|
## quirk
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
ARG PYTHONTAG=3.11.11-slim-bookworm
|
ARG PYTHONTAG=3.12.9-slim-bookworm
|
||||||
FROM docker.io/python:${PYTHONTAG} AS base-upstream
|
FROM docker.io/python:${PYTHONTAG} AS base-upstream
|
||||||
|
|
||||||
FROM base-upstream AS base-intermediate
|
FROM base-upstream AS base-intermediate
|
||||||
@@ -241,7 +241,7 @@ RUN set -f ; \
|
|||||||
done
|
done
|
||||||
|
|
||||||
## "docker.io/python"-specific cleanup
|
## "docker.io/python"-specific cleanup
|
||||||
RUN rm -f /root/.wget-hsts
|
RUN env -C /root rm -f .bash_history .python_history .wget-hsts
|
||||||
|
|
||||||
RUN pip-env.sh pip list --format freeze \
|
RUN pip-env.sh pip list --format freeze \
|
||||||
| grep -F '==' | awk -F= '{print $1}' \
|
| grep -F '==' | awk -F= '{print $1}' \
|
||||||
@@ -260,12 +260,6 @@ RUN libpython="${PYTHON_SITE_PACKAGES%/*}" ; \
|
|||||||
"${libpython}/turtle.py" \
|
"${libpython}/turtle.py" \
|
||||||
"${libpython}/turtledemo" \
|
"${libpython}/turtledemo" \
|
||||||
; \
|
; \
|
||||||
rm -rfv \
|
|
||||||
"${PYTHON_SITE_PACKAGES}/pkg_resources/tests" \
|
|
||||||
"${PYTHON_SITE_PACKAGES}/setuptools/tests" \
|
|
||||||
"${PYTHON_SITE_PACKAGES}/setuptools/_distutils/tests" \
|
|
||||||
"${PYTHON_SITE_PACKAGES}/setuptools/_vendor/importlib_resources/tests" \
|
|
||||||
; \
|
|
||||||
find "${PYTHON_SITE_PACKAGES}/" -iname '*.exe' -ls -delete ; \
|
find "${PYTHON_SITE_PACKAGES}/" -iname '*.exe' -ls -delete ; \
|
||||||
python-rm-cache.sh /usr/local
|
python-rm-cache.sh /usr/local
|
||||||
|
|
||||||
|
@@ -39,6 +39,8 @@ RUN w=$(mktemp -d) ; : "${w:?}" ; \
|
|||||||
pip-env.sh pip uninstall -y 'cython' ; \
|
pip-env.sh pip uninstall -y 'cython' ; \
|
||||||
python-rm-cache.sh /usr/local ; \
|
python-rm-cache.sh /usr/local ; \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
|
/usr/local/bin/patroni_aws \
|
||||||
|
/usr/local/bin/patroni_raft_controller \
|
||||||
"${PYTHON_SITE_PACKAGES}/etcd/tests" \
|
"${PYTHON_SITE_PACKAGES}/etcd/tests" \
|
||||||
"${PYTHON_SITE_PACKAGES}/netaddr/tests" \
|
"${PYTHON_SITE_PACKAGES}/netaddr/tests" \
|
||||||
"${PYTHON_SITE_PACKAGES}/psutil/tests" \
|
"${PYTHON_SITE_PACKAGES}/psutil/tests" \
|
||||||
@@ -62,13 +64,13 @@ RUN w=$(mktemp -d) ; : "${w:?}" ; \
|
|||||||
## avoid changing already present packages
|
## avoid changing already present packages
|
||||||
RUN find "${PYTHON_SITE_PACKAGES}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
RUN find "${PYTHON_SITE_PACKAGES}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
||||||
| sed -zEn \
|
| sed -zEn \
|
||||||
-e '/^((pip|setuptools|wheel)-.+\.dist-info|distutils-precedence\.pth|_distutils_hack|pip|pkg_resources|setuptools|wheel)$/p' \
|
-e '/^pip(|-.+\.dist-info)$/p' \
|
||||||
| env -C "${PYTHON_SITE_PACKAGES}" xargs -0r \
|
| env -C "${PYTHON_SITE_PACKAGES}" xargs -0r \
|
||||||
rm -rf
|
rm -rf
|
||||||
|
|
||||||
## ---
|
## ---
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps-intermediate
|
||||||
SHELL [ "/bin/sh", "-ec" ]
|
SHELL [ "/bin/sh", "-ec" ]
|
||||||
|
|
||||||
COPY /Dockerfile.deps /usr/local/share/
|
COPY /Dockerfile.deps /usr/local/share/
|
||||||
@@ -108,3 +110,55 @@ ENV LANG=en_US.UTF8
|
|||||||
|
|
||||||
RUN find /usr/local/sbin/ ! -type d -ls -delete ; \
|
RUN find /usr/local/sbin/ ! -type d -ls -delete ; \
|
||||||
jdupes -1LSpr /usr/
|
jdupes -1LSpr /usr/
|
||||||
|
|
||||||
|
## ---
|
||||||
|
|
||||||
|
FROM deps-intermediate AS pycache
|
||||||
|
SHELL [ "/bin/sh", "-ec" ]
|
||||||
|
|
||||||
|
COPY /scripts/* /usr/local/sbin/
|
||||||
|
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=''
|
||||||
|
|
||||||
|
## Python cache preseed
|
||||||
|
|
||||||
|
RUN libpython="${PYTHON_SITE_PACKAGES%/*}" ; \
|
||||||
|
find "${libpython}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
||||||
|
| sed -zEn \
|
||||||
|
-e '/^(asyncio|collections|concurrent|ctypes|email|encodings|html|http|importlib|json|logging|multiprocessing|re|urllib|zipfile|zoneinfo)$/p' \
|
||||||
|
| sort -zV \
|
||||||
|
| env -C "${libpython}" xargs -0r \
|
||||||
|
python3 -m compileall -q -j 2 ; \
|
||||||
|
find "${PYTHON_SITE_PACKAGES}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
||||||
|
| sed -zE \
|
||||||
|
-e '/\.(dist-info|pth|so|txt)$/d' \
|
||||||
|
-e '/^pip$/d' \
|
||||||
|
| sort -zV \
|
||||||
|
| env -C "${PYTHON_SITE_PACKAGES}" xargs -0r \
|
||||||
|
python3 -m compileall -q -j 2
|
||||||
|
|
||||||
|
## Python cache warmup
|
||||||
|
RUN export PYTHONPROFILEIMPORTTIME=1 ; \
|
||||||
|
patroni --help ; \
|
||||||
|
patronictl --help ; \
|
||||||
|
patroni_barman --help ; \
|
||||||
|
patroni_wale_restore --help ; \
|
||||||
|
cdiff --help ; \
|
||||||
|
netaddr --help ; \
|
||||||
|
ydiff --help
|
||||||
|
|
||||||
|
## Python cache adjustments
|
||||||
|
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-intermediate AS deps
|
||||||
|
|
||||||
|
## RFC: Python cache
|
||||||
|
COPY --from=pycache /pycache/ /usr/local/
|
||||||
|
@@ -8,7 +8,7 @@ BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}"
|
|||||||
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
|
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
|
||||||
set +a
|
set +a
|
||||||
|
|
||||||
PYTHONTAG="${PYTHONTAG:-3.11.11-slim-bookworm}"
|
PYTHONTAG="${PYTHONTAG:-3.12.9-slim-bookworm}"
|
||||||
|
|
||||||
grab_site_packages() {
|
grab_site_packages() {
|
||||||
podman run \
|
podman run \
|
||||||
@@ -27,7 +27,7 @@ grab_site_packages() {
|
|||||||
PYTHON_SITE_PACKAGES=$(grab_site_packages "docker.io/python:${PYTHONTAG}")
|
PYTHON_SITE_PACKAGES=$(grab_site_packages "docker.io/python:${PYTHONTAG}")
|
||||||
[ -n "${PYTHON_SITE_PACKAGES:?}" ]
|
[ -n "${PYTHON_SITE_PACKAGES:?}" ]
|
||||||
|
|
||||||
img="docker.io/rockdrilla/postgresql:base-v2"
|
img="docker.io/rockdrilla/postgresql:base-v3"
|
||||||
|
|
||||||
buildah bud \
|
buildah bud \
|
||||||
-f ./Dockerfile.base \
|
-f ./Dockerfile.base \
|
||||||
@@ -36,10 +36,6 @@ buildah bud \
|
|||||||
--build-arg "PYTHONTAG=${PYTHONTAG}" \
|
--build-arg "PYTHONTAG=${PYTHONTAG}" \
|
||||||
--env "PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" \
|
--env "PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" \
|
||||||
--unsetenv GPG_KEY \
|
--unsetenv GPG_KEY \
|
||||||
--unsetenv PYTHON_PIP_VERSION \
|
|
||||||
--unsetenv PYTHON_SETUPTOOLS_VERSION \
|
|
||||||
--unsetenv PYTHON_GET_PIP_SHA256 \
|
|
||||||
--unsetenv PYTHON_GET_PIP_URL \
|
|
||||||
|
|
||||||
|
|
||||||
c=$(buildah from --pull=never "${img}") || true
|
c=$(buildah from --pull=never "${img}") || true
|
||||||
|
@@ -8,8 +8,8 @@ BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}"
|
|||||||
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
|
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
|
||||||
set +a
|
set +a
|
||||||
|
|
||||||
img="docker.io/rockdrilla/postgresql:deps-v2"
|
img="docker.io/rockdrilla/postgresql:deps-v3"
|
||||||
base="docker.io/rockdrilla/postgresql:base-v2"
|
base="docker.io/rockdrilla/postgresql:base-v3"
|
||||||
|
|
||||||
exec buildah bud \
|
exec buildah bud \
|
||||||
-f ./Dockerfile.deps \
|
-f ./Dockerfile.deps \
|
||||||
|
@@ -12,7 +12,7 @@ POSTGRESQL_VERSION="${1:-16.7}"
|
|||||||
PG_MAJOR="${POSTGRESQL_VERSION%%.*}"
|
PG_MAJOR="${POSTGRESQL_VERSION%%.*}"
|
||||||
|
|
||||||
img="docker.io/rockdrilla/postgresql:${POSTGRESQL_VERSION}"
|
img="docker.io/rockdrilla/postgresql:${POSTGRESQL_VERSION}"
|
||||||
deps="docker.io/rockdrilla/postgresql:deps-v2"
|
deps="docker.io/rockdrilla/postgresql:deps-v3"
|
||||||
|
|
||||||
c=$(buildah from --pull=missing "${deps}")
|
c=$(buildah from --pull=missing "${deps}")
|
||||||
[ -n "${c:?}" ]
|
[ -n "${c:?}" ]
|
||||||
|
@@ -18,7 +18,7 @@ urllib3==2.3.0
|
|||||||
ydiff==1.4.2
|
ydiff==1.4.2
|
||||||
dnspython==2.7.0
|
dnspython==2.7.0
|
||||||
python-etcd==0.4.5
|
python-etcd==0.4.5
|
||||||
patroni[etcd3,kubernetes]==4.0.4
|
patroni[etcd3,kubernetes]==4.0.5
|
||||||
|
|
||||||
## misc
|
## misc
|
||||||
cdiff==1.0
|
cdiff==1.0
|
||||||
|
Reference in New Issue
Block a user