diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index cb20eed730873b053d3efc4b919a92badc592857..4fd07f429a71584f28df49735ddb39d7786a677a 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -20,10 +20,6 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.lis
 RUN apt-get update && apt-get install -y \
     nodejs \
     yarn \
-    chromium \
-    # libgbm1: newer chromium from puppeteer
-    libgbm1 \
-    firefox-esr \
     composer \
     php-zip \
     php-curl \
@@ -31,6 +27,15 @@ RUN apt-get update && apt-get install -y \
     sudo \
     && rm -rf /var/lib/apt/lists/*
 
+# only get dependencies of chromium/firefox
+RUN apt-get update && apt-get install --no-install-recommends -y \
+    chromium \
+    firefox-esr \
+    && apt-get remove -y \
+    chromium \
+    firefox-esr \
+    && rm -rf /var/lib/apt/lists/*
+
 RUN useradd -u 1000 -ms /bin/bash user
 RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
 USER user