Merge pull request #4734 from overleaf/jpa-server-ce-build

[misc] build the server-ce image from a local copybara synced repo

GitOrigin-RevId: 8e037668cdd2894e3fe909ec0da62f77e1f4c4d7
This commit is contained in:
Jakob Ackermann 2021-08-16 11:36:25 +02:00 committed by Copybot
parent a83be41adb
commit 2ce94153d4
5 changed files with 32 additions and 55 deletions

29
.gitignore vendored
View File

@ -1,25 +1,6 @@
/config
config-local
# docker image build
.dockerignore
node_modules/
api-data
versions/
web
document-updater
clsi
filestore
track-changes
docstore
chat
spelling
real-time
migrations/*.js
data
tmp
db.sqlite
.DS_Store
.vagrant
# user defined files
.env
docker-compose.override.yml

View File

@ -1,3 +1,4 @@
.DS_Store
.git/
node_modules/
libraries/
services/git-bridge

View File

@ -9,20 +9,14 @@ WORKDIR /var/www/sharelatex
# Add required source files
# -------------------------
ADD ${baseDir}/genScript.js /var/www/sharelatex/genScript.js
ADD ${baseDir}/services.js /var/www/sharelatex/services.js
ADD server-ce/genScript.js /var/www/sharelatex/genScript.js
ADD server-ce/services.js /var/www/sharelatex/services.js
ADD services/ /var/www/sharelatex/
# Checkout services
# -----------------
RUN node genScript checkout | bash \
\
# Store the revision for each service
# ---------------------------------------------
&& node genScript revisions | bash > /var/www/revisions.txt \
\
# Cleanup the git history
# -------------------
&& node genScript cleanup-git | bash
# Store the revision
# ------------------
ARG MONOREPO_REVISION
RUN echo "monorepo-server-ce,$MONOREPO_REVISION" > /var/www/revisions.txt
# Install npm dependencies
# ------------------------
@ -39,32 +33,32 @@ RUN ln -s /var/www/sharelatex/clsi/bin/synctex /opt/synctex
# Copy runit service startup scripts to its location
# --------------------------------------------------
ADD ${baseDir}/runit /etc/service
ADD server-ce/runit /etc/service
# Configure nginx
# ---------------
ADD ${baseDir}/nginx/nginx.conf.template /etc/nginx/templates/nginx.conf.template
ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf
ADD server-ce/nginx/nginx.conf.template /etc/nginx/templates/nginx.conf.template
ADD server-ce/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf
# Configure log rotation
# ----------------------
ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex
ADD server-ce/logrotate/sharelatex /etc/logrotate.d/sharelatex
RUN chmod 644 /etc/logrotate.d/sharelatex
# Copy Phusion Image startup scripts to its location
# --------------------------------------------------
COPY ${baseDir}/init_scripts/ /etc/my_init.d/
COPY server-ce/init_scripts/ /etc/my_init.d/
# Copy app settings files
# -----------------------
COPY ${baseDir}/settings.js /etc/sharelatex/settings.js
COPY server-ce/settings.js /etc/sharelatex/settings.js
# Copy grunt thin wrapper
# -----------------------
ADD ${baseDir}/bin/grunt /usr/local/bin/grunt
ADD server-ce/bin/grunt /usr/local/bin/grunt
RUN chmod +x /usr/local/bin/grunt
# Set Environment Variables

View File

@ -4,9 +4,6 @@
FROM phusion/baseimage:0.11
ENV baseDir .
# Makes sure LuaTex cache is writable
# -----------------------------------
ENV TEXMFVAR=/var/lib/sharelatex/tmp/texmf-var
@ -32,7 +29,7 @@ RUN apt-get update \
# Add envsubst
# ------------
ADD ./vendor/envsubst /usr/bin/envsubst
ADD server-ce/vendor/envsubst /usr/bin/envsubst
RUN chmod +x /usr/bin/envsubst
# Install TexLive

View File

@ -1,16 +1,20 @@
# Makefile
SHARELATEX_BASE_TAG := sharelatex/sharelatex-base
SHARELATEX_TAG := sharelatex/sharelatex
SHARELATEX_BASE_CACHE := $(shell echo $(SHARELATEX_BASE_TAG) | sed -E 's/(.+):.+/\1:latest/')
export SHARELATEX_BASE_TAG := sharelatex/sharelatex-base
export SHARELATEX_TAG := sharelatex/sharelatex
export SHARELATEX_BASE_CACHE := $(shell echo $(SHARELATEX_BASE_TAG) | sed -E 's/(.+):.+/\1:latest/')
export MONOREPO_REVISION := $(shell git rev-parse HEAD)
MONOREPO_ROOT := ../
build-base:
docker pull $(SHARELATEX_BASE_CACHE)
docker build -f Dockerfile-base --pull --cache-from $(SHARELATEX_BASE_CACHE) -t $(SHARELATEX_BASE_TAG) .
cp .dockerignore $(MONOREPO_ROOT)
docker pull $(SHARELATEX_BASE_CACHE) || echo "nothing cached yet"
docker build -f Dockerfile-base --pull --cache-from $(SHARELATEX_BASE_CACHE) -t $(SHARELATEX_BASE_TAG) $(MONOREPO_ROOT)
build-community:
docker build --build-arg SHARELATEX_BASE_TAG=$(SHARELATEX_BASE_TAG) -f Dockerfile -t $(SHARELATEX_TAG) .
cp .dockerignore $(MONOREPO_ROOT)
docker build --build-arg SHARELATEX_BASE_TAG --build-arg MONOREPO_REVISION -f Dockerfile -t $(SHARELATEX_TAG) $(MONOREPO_ROOT)
PHONY: build-base build-community