mirror of
https://github.com/9001/copyparty.git
synced 2026-01-06 19:45:40 +10:00
docker: use less RAM at runtime
compile to bytecode so cpython doesn't have to keep it in memory ram usage reduced by: * min: 5.4 MiB (32.6 to 27.2) * ac/im: 5.2 MiB (39.0 to 33.8) * dj/iv: 10.6 MiB (67.3 to 56.7) startup time reduced from: * min: 1.3s to 0.6s * ac/im: 1.6s to 0.9s * dj/iv: 2.0s to 1.1s image size increased by 4 MiB (min), 6 MiB (ac/im/iv), 9 MiB (dj) ram usage measured on idle with: while true; do ps aux | grep -E 'R[S]S|no[-]crt'; read -n1; echo; done startup time measured with: time podman run --rm -it localhost/copyparty-min-amd64 --exit=idx
This commit is contained in:
@@ -5,12 +5,11 @@ LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.title="copyparty-iv" \
|
||||
org.opencontainers.image.description="copyparty with Pillow, FFmpeg, libvips (image/audio/video thumbnails, audio transcoding, media tags)"
|
||||
ENV PYTHONPYCACHEPREFIX=/tmp/pyc \
|
||||
XDG_CONFIG_HOME=/cfg
|
||||
ENV XDG_CONFIG_HOME=/cfg
|
||||
|
||||
RUN apk add -U !pyc \
|
||||
wget \
|
||||
py3-argon2-cffi py3-pillow py3-pip py3-cffi \
|
||||
py3-jinja2 py3-argon2-cffi py3-pillow py3-pip py3-cffi \
|
||||
ffmpeg \
|
||||
vips-jxl vips-heif vips-poppler vips-magick \
|
||||
&& apk add -t .bd \
|
||||
@@ -18,13 +17,11 @@ RUN apk add -U !pyc \
|
||||
python3-dev py3-wheel \
|
||||
&& rm -f /usr/lib/python3*/EXTERNALLY-MANAGED \
|
||||
&& python3 -m pip install pyvips \
|
||||
&& apk del py3-pip .bd \
|
||||
&& rm -rf /var/cache/apk/* /tmp/pyc \
|
||||
&& mkdir /cfg /w \
|
||||
&& chmod 777 /cfg /w \
|
||||
&& echo % /cfg > initcfg
|
||||
&& apk del py3-pip .bd
|
||||
|
||||
COPY i/dist/copyparty-sfx.py innvikler.sh ./
|
||||
RUN ash innvikler.sh && rm innvikler.sh
|
||||
|
||||
COPY i/dist/copyparty-sfx.py ./
|
||||
WORKDIR /w
|
||||
EXPOSE 3923
|
||||
ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "--no-crt", "-c", "/z/initcfg"]
|
||||
ENTRYPOINT ["python3", "-m", "copyparty", "--no-crt", "-c", "/z/initcfg"]
|
||||
|
||||
Reference in New Issue
Block a user