dwaaan / HRConvert2-Docker

87 stars 17 forks source link

Update Dockerfile #10

Open schklom opened 2 years ago

schklom commented 2 years ago

Remove rar because it does the same job as unrar but is only available for amd64, which makes builds on other platforms break.

It works on arm64 platform.

bit-man commented 9 months ago

Fixed in fork https://gitlab.com/the-automation-club/hrconvert2-docker. Let's give a try!

archef2000 commented 9 months ago

Does * to rar conversion work ?

bit-man commented 9 months ago

Created an image for testing. Could you pull it and let me know if it works for you? docker pull bitman09/hrconvert2:3.1

archef2000 commented 9 months ago

2MB zip to rar convertion fails without usefull logs. It successfully unpacks the zip but it just says that it fails to create the rar. (arm64)

bit-man commented 9 months ago

Just reopened the bug (https://gitlab.com/the-automation-club/hrconvert2-docker/-/issues/1)

bit-man commented 9 months ago

Posting followups at https://gitlab.com/the-automation-club/hrconvert2-docker/-/issues/1. Not solved yet

bit-man commented 9 months ago

Sadly the convertion code need rar executable to compress in rar format

    // / Handle archiving of rar compatible files.
    if (in_array($UserExtension, $rararr)) $returnData = shell_exec('rar a -ep '.$newPathname.' '.$pathname);

My guess is that modifying the code to use another rar version compatible with others architectures is out of the question (https://github.com/zelon88/HRConvert2/issues/27)

archef2000 commented 9 months ago

I had success running rar with qemu-user-static on arm64. But HRConvert still fails. The executable is working in bash, is available to the www-data user and even a php shell could create the rar file.

My unoptimised code for arm64 only (The total image size is 2.2GB) Code:

# https://www.rarlab.com/rar/rarlinux-x64-5.1.1.tar.gz
# https://www.rarlab.com/rar/rarlinux-x64-6.0.2.tar.gz

RUN apt update \
    && apt install wget qemu-user-static -y \
    && wget https://www.rarlab.com/rar/rarlinux-x64-5.1.1.tar.gz \
    && tar -xzvf  rarlinux-x64-5.1.1.tar.gz \
    && chmod +x rar/rar

# install needed libaries: /lib64/ld-linux-x86-64.so.2; libstdc++.so.6
RUN wget https://geo.mirror.pkgbuild.com/core/os/x86_64/glibc-2.38-7-x86_64.pkg.tar.zst \
    && apt-get install zstd -y \
    && zstd -d glibc-2.38-7-x86_64.pkg.tar.zst \
    && tar -xvf glibc-2.38-7-x86_64.pkg.tar \
    && mkdir /lib64 \
    && cp lib/ld-linux-x86-64.so.2 /lib64 \
    && wget https://geo.mirror.pkgbuild.com/core/os/x86_64/gcc-libs-13.2.1-3-x86_64.pkg.tar.zst \
    && zstd -d gcc-libs-13.2.1-3-x86_64.pkg.tar.zst \
    && tar -xvf gcc-libs-13.2.1-3-x86_64.pkg.tar
    # qemu-x86_64-static rar/rar a test.rar rarlinux-x64-6.0.2.tar.gz

RUN echo "qemu-x86_64-static /rar/rar $@" > /usr/local/bin/rar && chmod +x /usr/local/bin/rar
bit-man commented 9 months ago

Took same approach but using package names instead

        dpkg --add-architecture i386 && \
        apt-get install qemu-user-static libc6-i386-cross libstdc++6-i386-cross -y && \
        cp /usr/i686-linux-gnu/lib/libm.so.6 /lib && \
        cp /usr/i686-linux-gnu/lib/libc.so.6 /lib && \
        cp /usr/i686-linux-gnu/lib/libpthread.so.0 /lib && \
        cp /usr/i686-linux-gnu/lib/ld-linux.so.2 /lib && \
        cp /usr/i686-linux-gnu/lib/libstdc++.so.6 /lib && \
        cp /usr/i686-linux-gnu/lib/libgcc_s.so.1  /lib && \
        wget https://www.rarlab.com/rar/rarlinux-x32-700b3.tar.gz  -O /tmp/rarlinux-x32-700b3.tar.gz && \
        tar -zxvf /tmp/rarlinux-x32-700b3.tar.gz -C /tmp && \
        chmod +x /tmp/rar-arm64 &&  ln -s  /tmp/rar-arm64 /usr/bin/rar; \
bit-man commented 9 months ago

Created new images for v3.1 with rar compression. Feel free to use it docker pull bitman09/hrconvert2:3.1