[misc] minimize the main stage (#122)

- cleanup git history
- do not install not needed npm packages
  - The Gruntfile was removed in
    REF: 27dd97ecc5

  - The simple-git package is not used since
    REF: df2d46df82
- cleanup npm cache
- cleanup node-gyp build cache
- cleanup /tmp
- move copying of the settings defaults after the installation

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
Jakob Ackermann 2020-02-13 16:38:58 +01:00 committed by GitHub
parent 3170a27fb5
commit b715f16a3b
2 changed files with 32 additions and 40 deletions

View file

@ -4,12 +4,6 @@
FROM sharelatex/sharelatex-base:latest FROM sharelatex/sharelatex-base:latest
ENV baseDir .
# Install app settings files
# --------------------------
ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee
ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee
@ -19,30 +13,43 @@ RUN git clone https://github.com/overleaf/overleaf.git \
--depth 1 /var/www/sharelatex --depth 1 /var/www/sharelatex
# Install dependencies needed to run configuration scripts # Copy build dependencies
# -------------------------------------------------------- # -----------------------
ADD ${baseDir}/package.json /var/www/package.json
ADD ${baseDir}/git-revision.sh /var/www/git-revision.sh ADD ${baseDir}/git-revision.sh /var/www/git-revision.sh
RUN cd /var/www && npm install
# Replace overleaf/config/services.js with the list of available
# services in Overleaf Community Edition
# --------------------------------------------------------------
ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js
# Checkout services # Checkout services
# ----------------- # -----------------
RUN cd /var/www/sharelatex && \ RUN cd /var/www/sharelatex \
npm install && grunt install; && npm install \
&& grunt install \
\
# install and compile services # Cleanup not needed artifacts
# ---------------------------- # ----------------------------
RUN bash -c 'cd /var/www/sharelatex && source ./bin/install-services' && rm -rf /root/.cache /root/.npm $(find /tmp/ -mindepth 1 -maxdepth 1) \
RUN bash -c 'cd /var/www/sharelatex && source ./bin/compile-services' # Stores the version installed for each service
# ---------------------------------------------
&& cd /var/www \
&& ./git-revision.sh > revisions.txt \
\
# Cleanup the git history
# -------------------
&& rm -rf $(find /var/www/sharelatex -name .git)
# Install npm dependencies
# ------------------------
RUN cd /var/www/sharelatex \
&& bash ./bin/install-services \
\
# Cleanup not needed artifacts
# ----------------------------
&& rm -rf /root/.cache /root/.npm $(find /tmp/ -mindepth 1 -maxdepth 1)
# Compile CoffeeScript
# --------------------
RUN cd /var/www/sharelatex \
&& bash ./bin/compile-services
# Links CLSI sycntex to its default location # Links CLSI sycntex to its default location
# ------------------------------------------ # ------------------------------------------
@ -69,11 +76,9 @@ ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex
# -------------------------------------------------- # --------------------------------------------------
COPY ${baseDir}/init_scripts/ /etc/my_init.d/ COPY ${baseDir}/init_scripts/ /etc/my_init.d/
# Copy app settings files
# Stores the version installed for each service # -----------------------
# --------------------------------------------- COPY ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee
RUN cd /var/www && ./git-revision.sh > revisions.txt
# Set Environment Variables # Set Environment Variables
# -------------------------------- # --------------------------------

View file

@ -1,13 +0,0 @@
{
"name": "none",
"author": "none",
"description": "none",
"dependencies": {
"grunt": "^0.4.5",
"grunt-contrib-rename": "0.0.3",
"grunt-docker-io": "^0.7.0",
"grunt-github-api": "^0.2.3",
"simple-git": "1.85.0",
"underscore": "^1.8.3"
}
}