Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
open-build-service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
obs
open-build-service
Commits
1375cfcf
Unverified
Commit
1375cfcf
authored
3 years ago
by
Andrej Shadura
Browse files
Options
Downloads
Patches
Plain Diff
Build assets in the base stage since they don’t change often
parent
fdc0beb1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+3
-0
3 additions, 0 deletions
.gitlab-ci.yml
Dockerfile.frontend
+8
-11
8 additions, 11 deletions
Dockerfile.frontend
Dockerfile.frontend-base
+34
-13
34 additions, 13 deletions
Dockerfile.frontend-base
with
45 additions
and
24 deletions
.gitlab-ci.yml
+
3
−
0
View file @
1375cfcf
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Dockerfile.frontend
+
8
−
11
View file @
1375cfcf
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Dockerfile.frontend-base
+
34
−
13
View file @
1375cfcf
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment