1
0

Compare commits

...

5 Commits

Author SHA1 Message Date
bb16585e34
bump version to 0.0.3 2024-10-10 00:23:55 +03:00
c38c488642
image: improve Python cache copying 2024-10-10 00:23:55 +03:00
9ff0ff517d
image: use jdupes
deduplicate data if possible
2024-10-10 00:23:55 +03:00
ff3564b0db
image: move dependencies
also install cron
2024-10-10 00:23:55 +03:00
c4feaf9f83
image: cleanup layers a bit more
mostly Python-related cleanup
2024-10-10 00:23:55 +03:00
18 changed files with 66 additions and 33 deletions

View File

@ -64,6 +64,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
@ -76,12 +82,10 @@ COPY /Dockerfile /usr/local/share/
COPY --from=setup /etc/apt/keyrings/angie.gpg.asc /etc/apt/keyrings/
COPY --from=setup /etc/apt/sources.list.d/angie.sources /etc/apt/sources.list.d/
## RFC: Python cache
## TODO: reduce load by selecting only __pycache__ directories in either way
COPY --from=pycache /usr/local/lib/ /usr/local/lib/
COPY /j2cfg/ /usr/local/lib/j2cfg/
## already copied by statement above
# COPY /j2cfg/ /usr/local/lib/j2cfg/
## RFC: Python cache
COPY --from=pycache /pycache/ /usr/local/
ENV ANGIE_MODULES_DIR=/usr/lib/angie/modules
@ -196,7 +200,8 @@ RUN apt-install-angie-mod.sh \
zip \
zstd \
; \
apt-clean.sh
apt-clean.sh ; \
jdupes -1LSpr /usr/
## adjust permissions/ownership
RUN d='/etc/angie' ; \

View File

@ -47,7 +47,19 @@ RUN divert_true() { divert-rm.sh "$1" ; ln -sv /bin/true "$1" ; } ; \
divert_true /usr/bin/deb-systemd-invoke
RUN apt-env.sh apt-get update ; \
apt-remove.sh \
ca-certificates \
e2fsprogs \
; \
apt-env.sh apt-get upgrade -y ; \
apt-install.sh \
cron \
jdupes \
logrotate \
netbase \
openssl \
procps \
; \
apt-clean.sh
## perl-base: hardlink->symlink
@ -78,6 +90,7 @@ RUN set -f ; \
chsh \
cpgr \
cppw \
crontab \
ctrlaltdel \
debugfs \
delgroup \
@ -194,12 +207,6 @@ RUN set -f ; \
done ; \
done
RUN apt-remove.sh \
ca-certificates \
e2fsprogs \
; \
apt-clean.sh
## "docker.io/python"-specific cleanup
RUN rm -f /root/.wget-hsts
@ -211,17 +218,33 @@ RUN pip-env.sh pip list --format freeze \
RUN libpython="${PYTHON_SITE_PACKAGES%/*}" ; \
rm -rfv \
/usr/local/bin/idle* \
/usr/local/bin/pydoc* \
"${libpython}/ensurepip/_bundled" \
"${libpython}/idlelib" \
"${libpython}/pydoc.py" \
"${libpython}/pydoc_data" \
"${libpython}/tkinter" \
"${libpython}/turtle.py" \
"${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 ; \
python-rm-cache.sh /usr/local
## adjust pip/certifi
RUN certifi_pem="${PYTHON_SITE_PACKAGES}/pip/_vendor/certifi/cacert.pem" ; \
rm -f "${certifi_pem}" ; \
ln -s /etc/ssl/certs/ca-certificates.crt "${certifi_pem}"
RUN find /usr/local/sbin/ ! -type d -ls -delete ; \
find /run/ -mindepth 1 -ls -delete || : ; \
install -d -m 01777 /run/lock
install -d -m 01777 /run/lock ; \
jdupes -1LSpr /usr/
## ---

View File

@ -41,12 +41,19 @@ RUN w=$(mktemp -d) ; : "${w:?}" ; \
echo ; \
find "${PYTHON_SITE_PACKAGES}/" -type f -name '*.so*' -printf '%p\0' \
| sed -zE '/rust/d' \
| xargs -0r strip --verbose --strip-debug ; \
| xargs -0r strip --verbose --strip-debug --strip-unneeded ; \
echo ; \
find "${PYTHON_SITE_PACKAGES}/" -type f -name '*.so*' -exec ls -l {} + ; \
apt-remove.sh build-essential ; \
apt-clean.sh
## avoid changing already present packages
RUN find "${PYTHON_SITE_PACKAGES}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
| sed -zEn \
-e '/^((pip|setuptools|wheel)-.+\.dist-info|distutils-precedence\.pth|_distutils_hack|pip|pkg_resources|setuptools|wheel)$/p' \
| env -C "${PYTHON_SITE_PACKAGES}" xargs -0r \
rm -rf
## ---
FROM base AS deps
@ -73,13 +80,11 @@ RUN apt-install.sh \
dumb-init \
gettext-base \
jq \
netbase \
netcat-openbsd \
openssl \
procps \
psmisc \
zstd \
; \
apt-clean.sh
RUN find /usr/local/sbin/ ! -type d -ls -delete
RUN find /usr/local/sbin/ ! -type d -ls -delete ; \
jdupes -1LSpr /usr/

View File

@ -2,7 +2,7 @@
set -ef
cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.2}"
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.3}"
set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -2,7 +2,7 @@
set -ef
cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.2}"
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.3}"
set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -2,7 +2,7 @@
set -ef
cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.2}"
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.3}"
set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/

View File

@ -11,7 +11,7 @@ server {
Dockerfile:
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/

View File

@ -58,7 +58,7 @@ services:
my-cache:
container_name: my-cache
image: docker.io/rockdrilla/angie-conv:v0.0.2
image: docker.io/rockdrilla/angie-conv:v0.0.3
restart: always
privileged: true
stop_grace_period: 15s

View File

@ -4,7 +4,7 @@ services:
my-cache:
container_name: my-cache
image: docker.io/rockdrilla/angie-conv:v0.0.2
image: docker.io/rockdrilla/angie-conv:v0.0.3
restart: always
privileged: true
stop_grace_period: 15s

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile:
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
COPY /site/ /etc/angie/site/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile:
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
COPY /site/ /etc/angie/site/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile:
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/

View File

@ -13,7 +13,7 @@ server {
Dockerfile:
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.2
FROM docker.io/rockdrilla/angie-conv:v0.0.3
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/