wader / static-ffmpeg

Multi-arch docker image with ffmpeg/ffprobe binaries built as hardened static PIE binaries with no external dependencies
https://hub.docker.com/r/mwader/static-ffmpeg/
MIT License
255 stars 62 forks source link

Build fails due to libass extraction #366

Closed danbo closed 10 months ago

danbo commented 10 months ago
> [builder  8/49] RUN   wget --retry-on-host-error --retry-on-http-error=429,500,502,503 -O libass.tar.gz "https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.gz" &&   echo "d653be97198a0543c69111122173c41a99e0b91426f9e17f06a858982c2fb03d  libass.tar.gz" | sha256sum --status -c - &&   tar xf libass.tar.gz &&   cd libass-* && ./configure --disable-shared --enable-static &&   make -j$(nproc) && make install:                                                                
0.489 --2023-11-15 02:36:58--  https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.gz                                                         
0.537 Resolving github.com (github.com)... 140.82.112.4                                                                                                               
0.540 Connecting to github.com (github.com)|140.82.112.4|:443... connected.
0.622 HTTP request sent, awaiting response... 302 Found
0.726 Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/11696642/41f30033-10b9-4ac7-a3e6-1dece4ba1ef3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231115%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231115T023658Z&X-Amz-Expires=300&X-Amz-Signature=dcc98db23cfab78d5cbd2a4494e41b3637711b865f129efe7568f0c3a882f908&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=11696642&response-content-disposition=attachment%3B%20filename%3Dlibass-0.17.1.tar.gz&response-content-type=application%2Foctet-stream [following]
0.726 --2023-11-15 02:36:58--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/11696642/41f30033-10b9-4ac7-a3e6-1dece4ba1ef3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231115%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231115T023658Z&X-Amz-Expires=300&X-Amz-Signature=dcc98db23cfab78d5cbd2a4494e41b3637711b865f129efe7568f0c3a882f908&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=11696642&response-content-disposition=attachment%3B%20filename%3Dlibass-0.17.1.tar.gz&response-content-type=application%2Foctet-stream
0.726 Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
0.771 Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
0.812 HTTP request sent, awaiting response... 200 OK
0.885 Length: 546658 (534K) [application/octet-stream]
0.885 Saving to: 'libass.tar.gz'
0.888 
0.888      0K .......... .......... .......... .......... ..........  9% 1.75M 0s
0.913     50K .......... .......... .......... .......... .......... 18% 3.59M 0s
0.927    100K .......... .......... .......... .......... .......... 28% 4.65M 0s
0.937    150K .......... .......... .......... .......... .......... 37% 7.04M 0s
0.944    200K .......... .......... .......... .......... .......... 46% 6.83M 0s
0.952    250K .......... .......... .......... .......... .......... 56% 1.83M 0s
0.978    300K .......... .......... .......... .......... .......... 65% 6.76M 0s
0.985    350K .......... .......... .......... .......... .......... 74% 5.74M 0s
0.994    400K .......... .......... .......... .......... .......... 84% 7.16M 0s
1.001    450K .......... .......... .......... .......... .......... 93% 8.02M 0s
1.007    500K .......... .......... .......... ...                  100% 11.3M=0.1s
1.010 
1.010 2023-11-15 02:36:59 (4.20 MB/s) - 'libass.tar.gz' saved [546658/546658]
1.010 
1.029 tar: libass-0.17.1/aclocal.m4: Cannot change ownership to uid 197609, gid 197609: Invalid argument
1.030 tar: libass-0.17.1/Changelog: Cannot change ownership to uid 197609, gid 197609: Invalid argument
... (many more)
1.078 tar: Exiting with failure status due to previous errors
------
Dockerfile:132
--------------------
 131 |     ARG LIBASS_SHA256=d653be97198a0543c69111122173c41a99e0b91426f9e17f06a858982c2fb03d
 132 | >>> RUN \
 133 | >>>   wget $WGET_OPTS -O libass.tar.gz "$LIBASS_URL" && \
 134 | >>>   echo "$LIBASS_SHA256  libass.tar.gz" | sha256sum --status -c - && \
 135 | >>>   tar xf libass.tar.gz && \
 136 | >>>   cd libass-* && ./configure --disable-shared --enable-static && \
 137 | >>>   make -j$(nproc) && make install
 138 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c wget $WGET_OPTS -O libass.tar.gz \"$LIBASS_URL\" &&   echo \"$LIBASS_SHA256  libass.tar.gz\" | sha256sum --status -c - &&   tar xf libass.tar.gz &&   cd libass-* && ./configure --disable-shared --enable-static &&   make -j$(nproc) && make install" did not complete successfully: exit code: 2

I got it to work by adding the --no-same-owner option to the tar command here:

tar xf libass.tar.gz ---no-same-owner && \


Docker version 24.0.7, build afdd53b

wader commented 10 months ago

Hey, thanks for the report. So it only happens for libass, other tar extractions are ok? maybe uses saner ids? did some googling and seems others have run into similar issues with rootless container etc that uses uid/gid mappings, is that the case for you too?

Anyways #367 should fix the issue i think

danbo commented 10 months ago

I was able to confirm by running the following command on a few dependencies:

tar -tvf <file.tar.gz>

libass was the only one that listed a non-root uid/gid, ie

tar -tvf libass-0.17.1.tar.gz 
drwxr-xr-x 197609/197609     0 2023-02-26 11:05 libass-0.17.1/
...
tar -tvf v2.3.1.tar.gz 
drwxrwxr-x root/root         0 2022-04-11 13:06 vmaf-2.3.1/
...
tar -tvf v1.0.3.tar.gz 
drwxrwxr-x root/root         0 2014-08-18 11:29 aribb24-1.0.3/
...