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 # docker image build
config-local .dockerignore
node_modules/ # user defined files
api-data .env
versions/ docker-compose.override.yml
web
document-updater
clsi
filestore
track-changes
docstore
chat
spelling
real-time
migrations/*.js
data
tmp
db.sqlite
.DS_Store
.vagrant

View file

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

View file

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

View file

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

View file

@ -1,16 +1,20 @@
# Makefile # Makefile
SHARELATEX_BASE_TAG := sharelatex/sharelatex-base export SHARELATEX_BASE_TAG := sharelatex/sharelatex-base
SHARELATEX_TAG := sharelatex/sharelatex export SHARELATEX_TAG := sharelatex/sharelatex
SHARELATEX_BASE_CACHE := $(shell echo $(SHARELATEX_BASE_TAG) | sed -E 's/(.+):.+/\1:latest/') 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: build-base:
docker pull $(SHARELATEX_BASE_CACHE) cp .dockerignore $(MONOREPO_ROOT)
docker build -f Dockerfile-base --pull --cache-from $(SHARELATEX_BASE_CACHE) -t $(SHARELATEX_BASE_TAG) . 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: 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 PHONY: build-base build-community