diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c9155951eb82231d425171d7822735487511a275..85c801f39bf3f5d181a9e4e94a44b9f31894a739 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,6 +36,9 @@ frontend-base:
   only:
     changes:
       - Dockerfile.frontend-base
+      - src/api/app/assets
+      - src/api/public
+      - src/api/vendor
       - src/api/Gemfile
       - src/api/Gemfile.lock
   variables:
diff --git a/Dockerfile.frontend b/Dockerfile.frontend
index 11628b66a1548af6fcc8c422e4b2bde1e168b0dc..d58b3be355f1bf118dc9391dba0f38ac3ffba03a 100644
--- a/Dockerfile.frontend
+++ b/Dockerfile.frontend
@@ -10,7 +10,14 @@ ARG INSTALLDIR=/obs
 
 ADD src/api/ $INSTALLDIR/src/api/
 
-COPY --from=base $INSTALLDIR/src/api/Gemfile $INSTALLDIR/src/api/Gemfile.lock $INSTALLDIR/src/api/
+COPY --from=base $INSTALLDIR/src/api/Gemfile.lock $INSTALLDIR/src/api/
+
+RUN sed -e "/gem 'puma'/d" Gemfile > Gemfile.new; \
+    echo "gem 'puma'" >> Gemfile.new; \
+    diff -u Gemfile Gemfile.new; \
+    mv Gemfile.new Gemfile
+
+COPY --from=base $INSTALLDIR/src/api/public/assets  $INSTALLDIR/src/api/public/assets
 
 WORKDIR $INSTALLDIR/src/api
 
@@ -19,21 +26,11 @@ RUN install -D -t public/css /usr/share/javascript/bootstrap/css/bootstrap.min.c
 
 RUN ls -la
 
-ARG BUNDLE_BUILD__SASSC=--disable-march-tune-native
 ARG NOKOGIRI_USE_SYSTEM_LIBRARIES=1
 
 RUN bundle install --jobs=$(nproc) --retry=3 \
  && rm -rf /var/lib/gems/*/cache
 
-ENV RAILS_ENV=production
-ENV RAILS_LOG_TO_STDOUT=true
-
-RUN echo nonce > config/secret.key \
- && DATABASE_URL=mysql2://localhost/noncedb bundle exec rake assets:precompile RAILS_GROUPS=assets \
- && rm config/secret.key
-
-RUN bundle config --local without test:assets:development
-
 RUN sed -i 's|^#!/usr/bin/ruby.ruby.*$|#!/usr/bin/ruby|' bin/* script/*
 RUN sed -i -e /mailcatcher:/d -e /web:/d Procfile
 
diff --git a/Dockerfile.frontend-base b/Dockerfile.frontend-base
index 3f42bae0bd1d03bbbec2a60d8ddd6d4c393840dc..c8ee2038ff5678475f183472992e0f3d11a53e71 100644
--- a/Dockerfile.frontend-base
+++ b/Dockerfile.frontend-base
@@ -1,7 +1,10 @@
-FROM debian:bookworm-slim as frontend-base
+ARG INSTALLDIR=/obs
+ARG DEBIAN_RELEASE=bookworm
+
+FROM debian:$DEBIAN_RELEASE-slim as base
 ENV LC_ALL=C.UTF-8
 ARG DEBIAN_FRONTEND=noninteractive
-ARG INSTALLDIR=/obs
+ARG INSTALLDIR
 
 RUN apt-get update \
  && apt-get install -y \
@@ -39,29 +42,47 @@ RUN apt-get update \
         libxslt1-dev \
         zlib1g-dev
 
-RUN gem install --no-format-executable brakeman --version 5.0.2 --no-doc
-RUN gem install sassc --version 2.0.1 --no-doc
-
 ADD src/api/Gemfile src/api/Gemfile.lock $INSTALLDIR/src/api/
 WORKDIR $INSTALLDIR/src/api/
 
-RUN sed -e "/gem 'puma'/d" Gemfile > Gemfile.new; \
-    echo "gem 'puma'" >> Gemfile.new; \
-    diff -u Gemfile Gemfile.new; \
-    mv Gemfile.new Gemfile
-
 RUN sed -e '/BUNDLED WITH/,+1 d' Gemfile.lock > Gemfile.lock.new; \
     diff -u Gemfile.lock Gemfile.lock.new; \
     mv Gemfile.lock.new Gemfile.lock
 
-ARG BUNDLE_BUILD__SASSC=--disable-march-tune-native
 ARG NOKOGIRI_USE_SYSTEM_LIBRARIES=1
 
-RUN bundle config --global without development:test
+RUN bundle config --global without assets:development:test
 
 RUN bundle install --jobs=$(nproc) --retry=3 \
  && rm -rf \
     /var/lib/gems/*/cache/ \
     /var/lib/gems/*/test/ \
     /var/lib/gems/*/extensions/*/*/*/gem_make.out \
-    /var/lib/gems/*/extensions/*/*/*/*.log \
+    /var/lib/gems/*/extensions/*/*/*/*.log
+
+ENV RAILS_ENV=production
+ENV RAILS_LOG_TO_STDOUT=true
+
+FROM base as asset-builder
+ARG INSTALLDIR
+
+ADD src/api/ $INSTALLDIR/src/api/
+
+COPY --from=base $INSTALLDIR/src/api/Gemfile $INSTALLDIR/src/api/Gemfile.lock $INSTALLDIR/src/api/
+
+ARG BUNDLE_BUILD__SASSC=--disable-march-tune-native
+ARG NOKOGIRI_USE_SYSTEM_LIBRARIES=1
+
+RUN gem install --no-format-executable brakeman --version 5.0.2 --no-doc
+RUN gem install sassc --version 2.0.1 --no-doc
+
+RUN bundle config --local without development:test
+
+RUN bundle install --jobs=$(nproc) --retry=3
+
+RUN echo nonce > config/secret.key \
+ && DATABASE_URL=mysql2://localhost/noncedb bundle exec rake assets:precompile RAILS_GROUPS=assets
+
+FROM base
+ARG INSTALLDIR
+COPY --from=asset-builder $INSTALLDIR/src/api/public/assets  $INSTALLDIR/src/api/public/assets