Skip to content
Snippets Groups Projects
Verified Commit c786f1d8 authored by David Mehren's avatar David Mehren
Browse files

Try to speed up building in Docker

parent ed3b6a1c
No related branches found
No related tags found
No related merge requests found
Pipeline #26745 failed
...@@ -3,6 +3,7 @@ image: docker:latest ...@@ -3,6 +3,7 @@ image: docker:latest
variables: variables:
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
DOCKER_BUILDKIT: 1
# Docker in Docker Service # Docker in Docker Service
services: services:
...@@ -14,8 +15,21 @@ before_script: ...@@ -14,8 +15,21 @@ before_script:
build-main: build-main:
script: script:
- docker pull $CI_REGISTRY_IMAGE || true - docker build --cache-from $CI_REGISTRY_IMAGE:stage-src \
- docker build --cache-from $CI_REGISTRY_IMAGE --pull -t "$CI_REGISTRY_IMAGE" -t "$CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG" . --target src \
--build-arg BUILDKIT_INLINE_CACHE=1 --pull \
-t "$CI_REGISTRY_IMAGE:stage-src" \
-t "$CI_REGISTRY_IMAGE:stage-src-branch-$CI_COMMIT_REF_SLUG" .
- docker build --cache-from $CI_REGISTRY_IMAGE:stage-texlive-update \
--target texlive-update \
--build-arg BUILDKIT_INLINE_CACHE=1 --pull \
-t "$CI_REGISTRY_IMAGE:stage-texlive-update" \
-t "$CI_REGISTRY_IMAGE:stage-texlive-update-branch-$CI_COMMIT_REF_SLUG" .
- docker build --cache-from $CI_REGISTRY_IMAGE \
--target app --squash \
--build-arg BUILDKIT_INLINE_CACHE=1 --pull \
-t "$CI_REGISTRY_IMAGE" \
-t "$CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE" - docker push "$CI_REGISTRY_IMAGE"
- docker push "$CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG" - docker push "$CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG"
only: only:
...@@ -23,8 +37,7 @@ build-main: ...@@ -23,8 +37,7 @@ build-main:
build: build:
script: script:
- docker pull $CI_REGISTRY_IMAGE || true - docker build --cache-from $CI_REGISTRY_IMAGE --build-arg BUILDKIT_INLINE_CACHE=1 --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker build --cache-from $CI_REGISTRY_IMAGE --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except: except:
- main - main
...@@ -6,7 +6,11 @@ RUN mkdir /src && cd /src && curl "$LDAP_PLUGIN_URL" | tar -xzf - --strip-compon ...@@ -6,7 +6,11 @@ RUN mkdir /src && cd /src && curl "$LDAP_PLUGIN_URL" | tar -xzf - --strip-compon
RUN ls /src RUN ls /src
RUN sysctl fs.file-max && lsof |wc -l && ulimit -n RUN sysctl fs.file-max && lsof |wc -l && ulimit -n
FROM $BASE FROM $BASE as texlive-update
RUN tlmgr update --self --all && tlmgr install scheme-full
FROM texlive-update as app
# passed from .env (via make) # passed from .env (via make)
ARG collab_text ARG collab_text
...@@ -15,23 +19,12 @@ ARG login_text ...@@ -15,23 +19,12 @@ ARG login_text
# set workdir (might solve issue #2 - see https://stackoverflow.com/questions/57534295/) # set workdir (might solve issue #2 - see https://stackoverflow.com/questions/57534295/)
WORKDIR /var/www/sharelatex/web WORKDIR /var/www/sharelatex/web
RUN tlmgr update --self --all && tlmgr install scheme-full
# install latest npm # install latest npm
RUN npm install -g npm RUN npm install -g npm
# clean cache (might solve issue #2) RUN npm install ldapts-search ldapts ldap-escape
#RUN npm cache clean --force
RUN npm install ldapts-search
RUN npm install ldapts
RUN npm install ldap-escape
#RUN npm install bcrypt@5.0.0
# This variant of updateing texlive does not work
#RUN bash -c tlmgr install scheme-full
# try this one:
RUN apt-get update RUN apt-get update
RUN apt-get -y install python-pygments RUN apt-get -y install python-pygments
#RUN apt-get -y install texlive texlive-lang-german texlive-latex-extra
# overwrite some files # overwrite some files
COPY --from=src /src/ldap-overleaf-sl/sharelatex/AuthenticationManager.js /var/www/sharelatex/web/app/src/Features/Authentication/ COPY --from=src /src/ldap-overleaf-sl/sharelatex/AuthenticationManager.js /var/www/sharelatex/web/app/src/Features/Authentication/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment