Skip to content

Commit

Permalink
Merge pull request overleaf#903 from overleaf/jpa-faster-install
Browse files Browse the repository at this point in the history
[perf] faster docker image builds
  • Loading branch information
das7pad authored Jul 8, 2021
2 parents c4ead8f + 3b63e1c commit d65a7fe
Show file tree
Hide file tree
Showing 5 changed files with 1,509 additions and 614 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ADD ${baseDir}/migrations /var/www/sharelatex/migrations
ADD ${baseDir}/tasks /var/www/sharelatex/tasks
ADD ${baseDir}/Gruntfile.coffee /var/www/sharelatex/Gruntfile.coffee
ADD ${baseDir}/package.json /var/www/sharelatex/package.json
ADD ${baseDir}/npm-shrinkwrap.json /var/www/sharelatex/npm-shrinkwrap.json
ADD ${baseDir}/package-lock.json /var/www/sharelatex/package-lock.json
ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js


Expand All @@ -29,7 +29,7 @@ ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js
# Checkout services
# -----------------
RUN cd /var/www/sharelatex \
&& npm install \
&& npm ci \
&& grunt install \
\
# Cleanup not needed artifacts
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

SHARELATEX_BASE_TAG := sharelatex/sharelatex-base
SHARELATEX_TAG := sharelatex/sharelatex
SHARELATEX_BASE_CACHE := $(shell echo $(SHARELATEX_BASE_TAG) | sed -E 's/(.+):.+/\1:latest/')

build-base:
docker build -f Dockerfile-base -t $(SHARELATEX_BASE_TAG) .
docker pull $(SHARELATEX_BASE_CACHE)
docker build -f Dockerfile-base --pull --cache-from $(SHARELATEX_BASE_CACHE) -t $(SHARELATEX_BASE_TAG) .


build-community:
Expand Down
10 changes: 9 additions & 1 deletion bin/install-services
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ grep 'name:' config/services.js | \
do
pushd $service
echo "Installing service $service"
npm install --quiet
case $service in
web)
# install webpack and friends from dev-dependencies.
npm ci
;;
*)
npm ci --only=production
;;
esac
popd
done

Loading

0 comments on commit d65a7fe

Please sign in to comment.