Smaller docker footprint (#1168)
This commit is contained in:
parent
ec4935b550
commit
9b115b3d16
|
|
@ -0,0 +1,5 @@
|
|||
*
|
||||
!bin
|
||||
!lib
|
||||
!package.json
|
||||
!docker
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
FROM sitespeedio/webbrowsers
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json /usr/src/app/
|
||||
RUN npm install
|
||||
COPY . /usr/src/app
|
||||
|
||||
COPY docker/scripts/start.sh /start.sh
|
||||
|
||||
ENTRYPOINT ["/start.sh"]
|
||||
VOLUME /sitespeed.io
|
||||
WORKDIR /sitespeed.io
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
FROM sitespeedio/browsers:4.0
|
||||
|
||||
MAINTAINER Peter Hedenskog <peter@soulgalore.com>
|
||||
|
||||
RUN apt-get update -y && apt-get install -y \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
--no-install-recommends --force-yes && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install nodejs
|
||||
RUN curl --silent --location https://deb.nodesource.com/setup_4.x | bash - && \
|
||||
apt-get install nodejs -y
|
||||
|
||||
# And get sitespeed
|
||||
RUN git clone https://github.com/sitespeedio/sitespeed.io.git && cd sitespeed.io && npm install -g
|
||||
|
||||
ADD ./scripts/ /home/root/scripts
|
||||
|
||||
VOLUME /sitespeed.io
|
||||
|
||||
WORKDIR /sitespeed.io
|
||||
|
|
@ -1,41 +1,16 @@
|
|||
# sitespeed.io
|
||||
Run ./build-all.sh from this directory to build all containers.
|
||||
|
||||
This Docker get you [sitespeed.io](http://www.sitespeed.io) with Chrome and Firefox installed.
|
||||
Note that all naming is temporary.
|
||||
|
||||
## Usage
|
||||
Once all are built, develop as normal, and just rebuild the sitespeed-app image.
|
||||
|
||||
The ```--rm -v "$(pwd)":/sitespeed.io``` will make the result HTML stored on your host.
|
||||
|
||||
### Analyze a site and fetch timings using Chrome
|
||||
```
|
||||
docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io sitespeed.io https://www.sitespeed.io -b chrome --browsertime.experimental.video
|
||||
A difference from the previous sitespeed image is that the sitespeed command is implicit. Just pass the args to the container as such:
|
||||
```sh
|
||||
docker run --rm sitespeed-app https://www.sitespeed.io -n1
|
||||
```
|
||||
|
||||
### Analyze a site and fetch timings using Firefox
|
||||
```
|
||||
docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io sitespeed.io https://www.sitespeed.io -b firefox --browsertime.experimental.video
|
||||
```
|
||||
|
||||
## Pro tip
|
||||
Always run sitespeed.io on specific version (always do that with Docker) meaning specify the tag after your container name. Then you have control of what versions you are using (both of sitespeed.io and the browsers). In practice, this means you should run it like this:
|
||||
```
|
||||
docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:3.6.0 sitespeed.io -u http://www.sitespeed.io -b firefox --seleniumServer http://127.0.0.1:4444/wd/hub
|
||||
```
|
||||
If you not use the tag after the container, the latest version will be downloaded and you will not have full control of the exact version.
|
||||
|
||||
|
||||
## Configuration
|
||||
sitespeed.io is highly configurable, check the [documentation](http://www.sitespeed.io/documentation).
|
||||
|
||||
## Update your container (use a new version)
|
||||
Say there's a new release of sitespeed.io and you want to run that, how do you do that? First check the [changelog](https://github.com/sitespeedio/sitespeed.io/blob/master/CHANGELOG.md). Are there any changes that will break what you do? If not, just pull the new version (change X.Y.Z to the version you want to use):
|
||||
|
||||
```
|
||||
docker pull sitespeedio/sitespeed.io:X.Y.Z
|
||||
```
|
||||
|
||||
And then change where you start your container like this:
|
||||
|
||||
```
|
||||
docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:X.Y.Z ...
|
||||
Notes:
|
||||
To launch the app container without launching sitespeed use
|
||||
```sh
|
||||
docker run -it --rm --entrypoint bash sitespeed-app
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
date
|
||||
# print versions
|
||||
|
||||
google-chrome-stable --version
|
||||
# Starting Firefox will get us this message
|
||||
# GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=833117
|
||||
# firefox -version
|
||||
firefox --version 2>/dev/null
|
||||
firefox --version
|
||||
|
||||
echo 'Starting Xvfb ...'
|
||||
export DISPLAY=:99
|
||||
2>/dev/null 1>&2 Xvfb :99 -shmem -screen 0 1366x768x16 &
|
||||
|
||||
exec "$@"
|
||||
2>/dev/null 1>&2 Xvfb :99 -ac -nolisten tcp -screen 0 1500x1200x16 &
|
||||
sleep 1
|
||||
exec /usr/src/app/bin/sitespeed.js "$@"
|
||||
|
|
|
|||
Loading…
Reference in New Issue