Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lighthouse + npm + inside docker using shell file provided for npm installs #4442

Open
Sarthakgp opened this issue Feb 20, 2025 · 6 comments

Comments

@Sarthakgp
Copy link

Sarthakgp commented Feb 20, 2025

Your question

I am unable to use lighthouse and google page speed index with sitespeed.io and I was not able to find any configuration for it

I am using dockerfile in which I use the shell file provided for sitespeed installation using npm

FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y \
    curl \
    wget \
    bash \
    ca-certificates \
    sudo \
    git \
    && rm -rf /var/lib/apt/lists/*
COPY docker_files/install-sitespeed.io-and-dependencies-ubuntu.sh /install-sitespeed-ubuntu.sh
RUN chmod +x /install-sitespeed-ubuntu.sh
RUN /install-sitespeed-ubuntu.sh
WORKDIR /sitespeed.io
CMD ["bash"]

The command I am running is as follows
sitespeedio@b241c2e33d32:~$ sitespeed.io https://www.sitespeed.io --xvfb -b chrome --video false --visualmetrics false --headless true --browsertime.chrome.args no-sandbox

How can I include lighthouse and gpsi metrics in this?

@soulgalore
Copy link
Member

Hi @Sarthakgp you need to install those plugins here's a Dockerfile that do that: https://github.com/sitespeedio/sitespeed.io/blob/main/docker/Dockerfile-plus1

@Sarthakgp
Copy link
Author

Hey @soulgalore thanks for responding. That makes sense. But even when I insert it in shell file

su - sitespeedio -c 'npm install @sitespeed.io/plugin-lighthouse -g --production' su - sitespeedio -c 'npm install @sitespeed.io/plugin-gpsi -g --production'

and
ENV SITESPEED_IO_PLUGINS__ADD @sitespeed.io/plugin-lighthouse,@sitespeed.io/plugin-gpsi

in my dockerfile the lighthouse.html is not generated

@soulgalore
Copy link
Member

If you use the pre-made container:

docker run --shm-size=1g --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:36.4.1-plus1 https://www.sitespeed.io/

as in https://www.sitespeed.io/documentation/sitespeed.io/lighthouse/ does it work for you then?

@Sarthakgp
Copy link
Author

Yes that is very great. I tried it but I was hoping to have more control over it using npm.
I even installed everything as per plus1 dockerfile and set env too but still I am facing issues with lighthouse and gpsi metrics. Any suggestions on this?

@soulgalore
Copy link
Member

Ok, I didn't fully understand, do you want to create your own Docker container (then follow the link on how we setup the container or do that not work for you?) or do you want to run using npm?

@Sarthakgp
Copy link
Author

Sarthakgp commented Feb 24, 2025

Ok sorry I was not able to explain properly. I want to create my own Docker container using my dockerfile which will have all installations using npm. I even included the shell file install-sitespeed-ubuntu.sh and plugins in the dockerfile but was not able to get the lighthouse metrics.

When I use the prebuilt plus-1 image I am able to get the lighthouse metrics but when I do the above process I am not able to get the lighthouse metrics

Following the above process gives me more control over things so I was hoping to do it that way. So any suggestion swill be helpful. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants