diff --git a/Dockerfile.agent b/Dockerfile.agent index eb314fbdea..682938f1d1 100644 --- a/Dockerfile.agent +++ b/Dockerfile.agent @@ -10,6 +10,29 @@ COPY ./tracetest /app/tracetest COPY ./agent/entrypoint.sh /app/entrypoint.sh RUN chmod +x /app/entrypoint.sh +USER root +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories \ + && echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ + && echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ + && echo "https://dl-cdn.alpinelinux.org/alpine/v3.16/main" >> /etc/apk/repositories \ + && echo "https://dl-cdn.alpinelinux.org/alpine/v3.16/community" \ + && apk upgrade -U -a \ + && apk add \ + libstdc++ \ + chromium \ + harfbuzz \ + nss \ + freetype \ + ttf-freefont \ + font-noto-emoji \ + wqy-zenhei \ + && rm -rf /var/cache/* \ + && mkdir /var/cache/apk + +# Playwright +ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/lib/chromium/chromium \ + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 + # Setup additional runtimes used by triggers RUN apk add nodejs npm diff --git a/agent/workers/trigger/playwrightengine.go b/agent/workers/trigger/playwrightengine.go index 63cafb8e2e..7f614761ce 100644 --- a/agent/workers/trigger/playwrightengine.go +++ b/agent/workers/trigger/playwrightengine.go @@ -81,23 +81,14 @@ func start(traceId, spanId, url, method string) (string, error) { return "", err } - res, err := execCommand( - app, - "playwright", - "install", - ) - - if err != nil { - return "", fmt.Errorf("error installing playwright: %s, %w", res, err) - } - path, err := filepath.Abs(fmt.Sprintf("%s/%s", wd, scriptPath)) if err != nil { return "", err } - res, err = execCommand( + res, err := execCommand( app, + "--yes", libName, "--scriptPath", path,