devops: do cache busting for APT (#2656)

To avoid caching old package lists, every `apt-get install`
should be prefixed with `apt-get update`.

More info on the matter:
- https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get
- https://github.com/moby/moby/issues/3313
This commit is contained in:
Andrey Lushnikov 2020-06-22 15:54:19 -07:00 committed by GitHub
parent 40b1a14626
commit bb34418095
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,43 +15,43 @@ RUN apt-get update && apt-get install -y curl && \
apt-get install -y nodejs apt-get install -y nodejs
# 2. Install WebKit dependencies # 2. Install WebKit dependencies
RUN apt-get install -y libwoff1 \ RUN apt-get update && apt-get install -y libwoff1 \
libopus0 \ libopus0 \
libwebp6 \ libwebp6 \
libwebpdemux2 \ libwebpdemux2 \
libenchant1c2a \ libenchant1c2a \
libgudev-1.0-0 \ libgudev-1.0-0 \
libsecret-1-0 \ libsecret-1-0 \
libhyphen0 \ libhyphen0 \
libgdk-pixbuf2.0-0 \ libgdk-pixbuf2.0-0 \
libegl1 \ libegl1 \
libnotify4 \ libnotify4 \
libxslt1.1 \ libxslt1.1 \
libevent-2.1-6 \ libevent-2.1-6 \
libgles2 \ libgles2 \
libvpx5 libvpx5
# 3. Install gstreamer and plugins to support video playback in WebKit. # 3. Install gstreamer and plugins to support video playback in WebKit.
RUN apt-get install -y gstreamer1.0-gl \ RUN apt-get update && apt-get install -y gstreamer1.0-gl \
gstreamer1.0-plugins-base \ gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \ gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad
# 4. Install Chromium dependencies # 4. Install Chromium dependencies
RUN apt-get install -y libnss3 \ RUN apt-get update && apt-get install -y libnss3 \
libxss1 \ libxss1 \
libasound2 \ libasound2 \
fonts-noto-color-emoji fonts-noto-color-emoji
# 5. Install Firefox dependencies # 5. Install Firefox dependencies
RUN apt-get install -y libdbus-glib-1-2 \ RUN apt-get update && apt-get install -y libdbus-glib-1-2 \
libxt6 libxt6
# 6. Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox. # 6. Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox.
RUN apt-get install -y ffmpeg RUN apt-get update && apt-get install -y ffmpeg
# 7. Add user so we don't need --no-sandbox in Chromium # 7. Add user so we don't need --no-sandbox in Chromium
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \ RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
@ -59,7 +59,7 @@ RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
&& chown -R pwuser:pwuser /home/pwuser && chown -R pwuser:pwuser /home/pwuser
# 8. (Optional) Install XVFB if there's a need to run browsers in headful mode # 8. (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get install -y xvfb RUN apt-get update && apt-get install -y xvfb
# Run everything after as non-privileged user. # Run everything after as non-privileged user.
USER pwuser USER pwuser