Commit 7f30e9c4 authored by Sebastian Hasler's avatar Sebastian Hasler
Browse files
parent 47baa872
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+34 −0
Original line number Diff line number Diff line
variables:
  DOCKER_DRIVER: vfs

image: docker
services:
  - name: docker:19-dind
    # Currently we need this ugly workaround in order to use docker in Kata:
    entrypoint:
      - sh
      - -c
      - >-
        mkdir /sys/fs/cgroup/systemd
        && mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
        && exec dockerd-entrypoint.sh

before_script:
  - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  - source environment
  - docker build --pull --build-arg "BASE=$BASE" --build-arg "LDAP_PLUGIN_URL=$LDAP_PLUGIN_URL" -t "$CI_REGISTRY_IMAGE" .

build-main:
  script:
    - docker tag "$CI_REGISTRY_IMAGE" "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
    - docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
    - docker push "$CI_REGISTRY_IMAGE"
  only:
    - main

build:
  script:
    - docker tag "$CI_REGISTRY_IMAGE" "$CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG"
    - docker push "$CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG"
  except:
    - main

Dockerfile

0 → 100644
+60 −0
Original line number Diff line number Diff line
ARG BASE=docker.io/sharelatex/sharelatex

FROM nixpkgs/curl as src
ARG LDAP_PLUGIN_URL=https://codeload.github.com/smhaller/ldap-overleaf-sl/tar.gz/master
RUN mkdir /src && cd /src && curl "$LDAP_PLUGIN_URL" | tar -xzf - --strip-components=1
RUN ls /src

FROM $BASE

# passed from .env (via make)
ARG collab_text
ARG login_text

# set workdir (might solve issue #2 - see https://stackoverflow.com/questions/57534295/)
WORKDIR /var/www/sharelatex/web

# install latest npm
RUN npm install -g npm
# clean cache (might solve issue #2)
#RUN npm cache clean --force
RUN npm install ldapts-search
RUN npm install ldapts
#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 -y install python-pygments
#RUN apt-get -y install texlive texlive-lang-german texlive-latex-extra 

# 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/ContactController.js /var/www/sharelatex/web/app/src/Features/Contacts/

# instead of copying the login.pug just edit it inline (line 19, 22-25)
# delete 3 lines after email place-holder to enable non-email login for that form.
RUN sed -iE '/type=.*email.*/d' /var/www/sharelatex/web/app/views/user/login.pug
RUN sed -iE '/email@example.com/{n;N;N;d}' /var/www/sharelatex/web/app/views/user/login.pug
RUN sed -iE "s/email@example.com/${login_text:-user}/g" /var/www/sharelatex/web/app/views/user/login.pug

# Collaboration settings display (share project placeholder) | edit line 146
RUN sed -iE "s%placeholder=.*$%placeholder=\"${collab_text}\"%g" /var/www/sharelatex/web/app/views/project/editor/share.pug

# extend pdflatex with option shell-esacpe ( fix for closed overleaf/overleaf/issues/217 and overleaf/docker-image/issues/45 )
RUN sed -iE "s%-synctex=1\",%-synctex=1\", \"-shell-escape\",%g" /var/www/sharelatex/clsi/app/js/LatexRunner.js

# Too much changes to do inline (>10 Lines).
COPY --from=src /src/ldap-overleaf-sl/sharelatex/settings.pug /var/www/sharelatex/web/app/views/user/
COPY --from=src /src/ldap-overleaf-sl/sharelatex/navbar.pug /var/www/sharelatex/web/app/views/layout/

# Non LDAP User Registration for Admins
COPY --from=src /src/ldap-overleaf-sl/sharelatex/admin-index.pug /var/www/sharelatex/web/app/views/admin/index.pug
RUN rm /var/www/sharelatex/web/app/views/admin/register.pug

### To remove comments entirly (bug https://github.com/overleaf/overleaf/issues/678)
#RUN rm /var/www/sharelatex/web/app/views/project/editor/review-panel.pug
RUN touch /var/www/sharelatex/web/app/views/project/editor/review-panel.pug

RUN tlmgr update --self && tlmgr install scheme-full

LICENSE

0 → 100644
+661 −0

File added.

Preview size limit exceeded, changes collapsed.

README.md

0 → 100644
+31 −0
Original line number Diff line number Diff line
# docker-overleaf-ldap

[![pipeline status](https://git.stuvus.uni-stuttgart.de/ref-it/docker-overleaf-ldap/badges/main/pipeline.svg)](https://git.stuvus.uni-stuttgart.de/ref-it/docker-overleaf-ldap/-/pipelines?ref=main)

This repository provides an OCI image for
[Overleaf](https://github.com/overleaf/overleaf) bundled with
[ldap-overleaf-sl](https://github.com/smhaller/ldap-overleaf-sl)
to support LDAP authentication.
One can use [Docker](https://www.docker.com/) in order to build the image,
as follows.

```sh
docker build --build-arg BASE=docker.io/sharelatex/sharelatex:2.6.1 -t docker-overleaf-ldap .
```

## Build arguments

The following arguments can be passed via `--build-args`.

| Argument          | Default                                                               | Description                                                                                                                                            |
| ----------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `BASE`            | `docker.io/sharelatex/sharelatex`                                     | Can be set to any Overleaf image tag. See [here](https://hub.docker.com/r/sharelatex/sharelatex/tags?page=1&ordering=last_updated) for a list of tags. |
| `LDAP_PLUGIN_URL` | `https://codeload.github.com/smhaller/ldap-overleaf-sl/tar.gz/master` | URL to download ldap-overleaf-sl from.                                                                                                                 |

## GitLab CI

The `environment` file is used to specify some environment variables for the GitLab CI:

* `BASE`: Gets passed to the `BASE` build argument.
* `LDAP_PLUGIN_URL`: Gets passed to the `LDAP_PLUGIN_URL` build argument.
* `IMAGE_TAG`: Is used as image tag, but only in the build for the branch `main`.

environment

0 → 100644
+3 −0
Original line number Diff line number Diff line
BASE=docker.io/sharelatex/sharelatex:2.6.1
LDAP_PLUGIN_URL=https://codeload.github.com/chhu/ldap-overleaf-sl/tar.gz/53a4ba6b4f95499c1d1350ea8e4b9ab41e611552
IMAGE_TAG=2.6.1