catchpoint / WebPageTest

Official repository for WebPageTest
Other
3.08k stars 714 forks source link

Docker Image Fails to Configure FFMPEG on x64 Platforms #2902

Open caseycarroll opened 1 year ago

caseycarroll commented 1 year ago

Description

When using docker-compose up on a Windows or Linux machine, the build fails at line https://github.com/WPO-Foundation/webpagetest/blob/master/docker/local/Dockerfile-php#L45.

It builds successfully after removing the --enable-librav1e flag. I did some digging and it appears the error is:

ERROR: rav1e >= 0.1.0 not found using pkg-config

This is odd because it appears that lib gets added on this line: https://github.com/WPO-Foundation/webpagetest/blob/master/docker/local/Dockerfile-php#L35

To make it weirder, this build error does not occur when running docker-compose up on an M1 Macbook.

Steps to reproduce

  1. Use a non ARM system
  2. Run docker-compose up from the root of the project
  3. Observe error:
    failed to solve: process "/bin/sh -c ./configure     --enable-version3     --enable-gpl     --enable-nonfree     --enable-small     --enable-libmp3lame     --enable-libx264     --enable-libx265     --enable-libvpx     --enable-libtheora     --enable-libvorbis     --enable-libopus     --enable-libfdk-aac     --enable-libass     --enable-libwebp     --enable-librtmp     --enable-librav1e     --enable-postproc     --enable-avresample     --enable-libfreetype     --enable-filter=scale     --enable-filter=decimate     --enable-openssl     --disable-debug     --disable-doc     --disable-ffplay     --extra-cflags=\"-I${PREFIX}/include\"     --extra-ldflags=\"-L${PREFIX}/lib\"     --extra-libs=\"-lpthread -lm\"     --prefix=\"${PREFIX}\"     && make     && make install     && make distclean" did not complete successfully: exit code: 1

Expected result

Docker build step completes successfully.

Actual result

Docker build step fails

Related issues?

May be related to https://github.com/WPO-Foundation/webpagetest/pull/2865

caseycarroll commented 1 year ago

Reproducible on M1 MacBook if you set the following environment variable: export DOCKER_DEFAULT_PLATFORM=linux/amd64

anthonymunene commented 1 year ago

Can confirm that our docker builds are also failing as a result @caseycarroll have you managed to find a workaround?

caseycarroll commented 1 year ago

@anthonymunene Sorry, I've yet to find a workaround. I've tried removing the --enable-librav1e flag to get it to build, but that in turn breaks WPT at runtime. When I run a test, I get invalid results. I assume this is because WPT doesn't have a video to gather data from.

dreadedhamish commented 1 year ago

Issue persists - running linux (Manjaro)

Baachi commented 1 year ago

We upgraded our alpine image to alpine:3.18 which solves this issue.

dreadedhamish commented 1 year ago

We upgraded our alpine image to alpine:3.18 which solves this issue.

was that your only change? I played with upgrading alpine, FFMPEG, and php-fpm-alpine and managed to progres much further but not all the way - but I may not have updated only alpine.

EDIT: actually the current dockerfile already uses 3.18

caseycarroll commented 1 year ago

Dockerfile-PHP uses Alpine 3.13. https://github.com/WPO-Foundation/webpagetest/blob/master/docker/local/Dockerfile-php#L1

I can't test bumping it at the moment due to my work firewall blocking Alpine repo connections. @dreadedhamish Can you try bumping 3.13 to 3.18 and report back?

Baachi commented 1 year ago

Not the running php stage needs 3.18, the build stage needs to be alpine:3.18. So yes @caseycarroll is correct :)

dreadedhamish commented 1 year ago

I just did a fresh pull of the repo and changed only the alpine version in Dockerfile-php, and received this error: failed to solve: failed to compute cache key: failed to calculate checksum of ref f5514354-d284-4298-b675-fab6238118ef::syi5dmgclhoymgb5u57g8f6dg: "/usr/lib/libx265.so.192": not found

From the look of it the dockerfile is calling versioned libraries, but the apt-get would get the most current?