Try to speed up building in Docker
This commit is contained in:
parent
ed3b6a1cc8
commit
c786f1d855
2 changed files with 23 additions and 17 deletions
|
@ -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:
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
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
|
||||||
|
|
19
Dockerfile
19
Dockerfile
|
@ -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
|
||||||
# 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/
|
||||||
|
|
Loading…
Reference in a new issue