diff --git a/scripts/bench/filehash.sh b/scripts/bench/filehash.sh index 876107d0..c70a0dd6 100755 --- a/scripts/bench/filehash.sh +++ b/scripts/bench/filehash.sh @@ -21,7 +21,7 @@ set -euo pipefail sfx="$1" shift sfx="$(realpath "$sfx" || readlink -e "$sfx" || echo "$sfx")" -awk=$(which gawk || which awk) +awk=$(command -v gawk || command -v awk) # try to use /dev/shm to avoid hitting filesystems at all, # otherwise fallback to mktemp which probably uses /tmp @@ -65,3 +65,4 @@ echo deleting $td and exiting # notes, # podman run --rm -it --shm-size 512m --entrypoint /bin/ash localhost/copyparty-min +# podman initcfg + +COPY i/dist/copyparty-sfx.py ./ +WORKDIR /w +EXPOSE 3923 +ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "--no-crt", "-c", "/z/initcfg"] + +# size: 598 MB +# bpm/key: 485 sec +# idx-bench: 2751 MB/s + +# notes: +# libraqm0 (pillow dep) pulls in the other packages mentioned on the dpkg line; saves 50m + +# advantage: official packages only +# advantage: ffmpeg with gme, codec2, radiance-hdr +# drawback: ffmpeg bloat; dc1394, flite, mfx, xorg +# drawback: python packaging is a bit jank +# drawback: they apply exciting patches due to old deps +# drawback: dropping perl the hard way might cause issues diff --git a/scripts/docker/Dockerfile.djf b/scripts/docker/Dockerfile.djf new file mode 100644 index 00000000..518a9b62 --- /dev/null +++ b/scripts/docker/Dockerfile.djf @@ -0,0 +1,68 @@ +FROM fedora:38 +WORKDIR /z +LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \ + org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="copyparty-djf" \ + org.opencontainers.image.description="copyparty with all optional dependencies, including musical key / bpm detection, and higher performance than the other editions" +ENV PYTHONPYCACHEPREFIX=/tmp/pyc \ + XDG_CONFIG_HOME=/cfg + +COPY i/bin/mtag/install-deps.sh ./ +COPY i/bin/mtag/audio-bpm.py /mtag/ +COPY i/bin/mtag/audio-key.py /mtag/ +RUN dnf install -y \ + https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \ + https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm \ + && dnf install -y --setopt=install_weak_deps=False \ + wget \ + python3-argon2-cffi python3-pillow python3-pip python3-cffi \ + ffmpeg \ + vips vips-jxl vips-poppler vips-magick \ + python3-numpy fftw libsndfile \ + gcc gcc-c++ make cmake patchelf jq \ + python3-devel ffmpeg-devel fftw-devel libsndfile-devel python3-setuptools \ + vamp-plugin-sdk qm-vamp-plugins \ + vamp-plugin-sdk-devel vamp-plugin-sdk-static \ + && python3 -m pip install --user pyvips \ + && bash install-deps.sh \ + && dnf erase -y \ + gcc gcc-c++ make cmake patchelf jq \ + python3-devel ffmpeg-devel fftw-devel libsndfile-devel python3-setuptools \ + vamp-plugin-sdk-devel vamp-plugin-sdk-static \ + && dnf clean all \ + && find /usr/ -name __pycache__ | xargs rm -rf \ + && find /usr/ -type d -name tests | grep packages/numpy | xargs rm -rf \ + && rm -rf \ + /usr/share/adobe \ + /usr/share/fonts \ + /usr/share/graphviz \ + /usr/share/poppler/cMap \ + /usr/share/licenses \ + /usr/share/ghostscript \ + /usr/share/tesseract \ + /usr/share/X11 \ + /usr/share/hwdata \ + /usr/share/python-wheels \ + /usr/bin/cyrusbdb2current \ + && rm -rf /tmp/pyc \ + && chmod 777 /root \ + && ln -s /root/vamp /root/.local / \ + && mkdir /cfg /w \ + && chmod 777 /cfg /w \ + && echo % /cfg > initcfg + +COPY i/dist/copyparty-sfx.py ./ +WORKDIR /w +EXPOSE 3923 +ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "--no-crt", "-c", "/z/initcfg"] + +# size: 648 MB +# bpm/key: 410 sec +# idx-bench: 2744 MB/s + +# advantage: fairly recent and sane ffmpeg build +# drawback: ffmpeg without gme, codec2, radiance-hdr +# drawback: ffmpeg from rpmfusion, which is both better and smaller than ffmpeg-free, can occasionally fail to install due to repo desync / conflicts +# drawback: ffmpeg bloat; samba, modplug, v4l2 +# drawback: manual purging (graphviz/poppler/cmap) can break stuff diff --git a/scripts/docker/Dockerfile.djff b/scripts/docker/Dockerfile.djff new file mode 100644 index 00000000..9d562362 --- /dev/null +++ b/scripts/docker/Dockerfile.djff @@ -0,0 +1,61 @@ +FROM fedora:38 +WORKDIR /z +LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \ + org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="copyparty-djff" \ + org.opencontainers.image.description="copyparty with all optional dependencies, including musical key / bpm detection, and higher performance than the other editions" +ENV PYTHONPYCACHEPREFIX=/tmp/pyc \ + XDG_CONFIG_HOME=/cfg + +COPY i/bin/mtag/install-deps.sh ./ +COPY i/bin/mtag/audio-bpm.py /mtag/ +COPY i/bin/mtag/audio-key.py /mtag/ +RUN dnf install -y --setopt=install_weak_deps=False \ + wget \ + python3-argon2-cffi python3-pillow python3-pip python3-cffi \ + ffmpeg-free \ + vips vips-jxl vips-poppler vips-magick \ + python3-numpy fftw libsndfile \ + gcc gcc-c++ make cmake patchelf jq \ + python3-devel ffmpeg-free-devel fftw-devel libsndfile-devel python3-setuptools \ + vamp-plugin-sdk qm-vamp-plugins \ + vamp-plugin-sdk-devel vamp-plugin-sdk-static \ + && python3 -m pip install --user pyvips \ + && bash install-deps.sh \ + && dnf erase -y \ + gcc gcc-c++ make cmake patchelf jq \ + python3-devel ffmpeg-free-devel fftw-devel libsndfile-devel python3-setuptools \ + vamp-plugin-sdk-devel vamp-plugin-sdk-static \ + && dnf clean all \ + && find /usr/ -name __pycache__ | xargs rm -rf \ + && find /usr/ -type d -name tests | grep packages/numpy | xargs rm -rf \ + && rm -rf \ + /usr/share/adobe \ + /usr/share/fonts \ + /usr/share/graphviz \ + /usr/share/poppler/cMap \ + /usr/share/licenses \ + /usr/share/ghostscript \ + /usr/share/tesseract \ + /usr/share/X11 \ + /usr/share/hwdata \ + /usr/share/python-wheels \ + /usr/bin/cyrusbdb2current \ + && rm -rf /tmp/pyc \ + && chmod 777 /root \ + && ln -s /root/vamp /root/.local / \ + && mkdir /cfg /w \ + && chmod 777 /cfg /w \ + && echo % /cfg > initcfg + +COPY i/dist/copyparty-sfx.py ./ +WORKDIR /w +EXPOSE 3923 +ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "--no-crt", "-c", "/z/initcfg"] + +# size: 673 MB +# bpm/key: 408 sec +# idx-bench: 2744 MB/s + +# drawback: less ffmpeg features we want, more features we don't (compared to rpmfusion) diff --git a/scripts/docker/Dockerfile.dju b/scripts/docker/Dockerfile.dju new file mode 100644 index 00000000..7ea6699a --- /dev/null +++ b/scripts/docker/Dockerfile.dju @@ -0,0 +1,69 @@ +FROM ubuntu:23.04 +WORKDIR /z +LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \ + org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="copyparty-dju" \ + org.opencontainers.image.description="copyparty with all optional dependencies, including musical key / bpm detection, and higher performance than the other editions" +ENV PYTHONPYCACHEPREFIX=/tmp/pyc \ + XDG_CONFIG_HOME=/cfg + +COPY i/bin/mtag/install-deps.sh ./ +COPY i/bin/mtag/audio-bpm.py /mtag/ +COPY i/bin/mtag/audio-key.py /mtag/ + +RUN apt update \ + && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ + wget \ + python3-argon2 python3-pillow python3-pip \ + ffmpeg libvips42 vamp-plugin-sdk \ + python3-numpy libfftw3-double3 libsndfile1 \ + gcc g++ make cmake patchelf jq \ + libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \ + libfftw3-dev python3-dev libsndfile1-dev python3-pip \ + patchelf cmake \ + && rm -f /usr/lib/python3*/EXTERNALLY-MANAGED + +RUN python3 -m pip install --user pyvips \ + && bash install-deps.sh \ + && DEBIAN_FRONTEND=noninteractive apt purge -y \ + gcc g++ make cmake patchelf jq \ + libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \ + libfftw3-dev python3-dev libsndfile1-dev python3-pip \ + patchelf cmake \ + && DEBIAN_FRONTEND=noninteractive apt-get clean -y \ + && DEBIAN_FRONTEND=noninteractive apt-get autoremove -y \ + && find /usr/ -name __pycache__ | xargs rm -rf \ + && find /usr/ -type d -name tests | grep site-packages/numpy | xargs rm -rf \ + && rm -rf \ + /var/lib/apt/lists/* \ + /tmp/pyc \ + /usr/lib/python*/dist-packages/pip \ + /usr/lib/python*/dist-packages/setuptools \ + /usr/lib/*/dri \ + /usr/lib/*/mfx \ + /usr/share/doc \ + /usr/share/X11 \ + /usr/share/fonts \ + /usr/share/libmysofa \ + /usr/share/libthai \ + /usr/share/alsa \ + /usr/share/bash-completion \ + && chmod 777 /root \ + && ln -s /root/vamp /root/.local / \ + && mkdir /cfg /w \ + && chmod 777 /cfg /w \ + && echo % /cfg > initcfg + +COPY i/dist/copyparty-sfx.py ./ +WORKDIR /w +EXPOSE 3923 +ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "--no-crt", "-c", "/z/initcfg"] + +# size: 1198 MB (wowee) +# bpm/key: 516 sec +# idx-bench: 2751 MB/s + +# advantage: official packages only +# advantage: ffmpeg with gme, codec2, radiance-hdr +# drawback: python packaging is a bit jank