diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2019-08-22 13:43:33 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-08-22 13:43:33 +0300 |
commit | 6bd9a01ae4c3232386cc56cdf3607d8d58ec5120 (patch) | |
tree | f2e8d084b34671961bef25ebb69a61f2281f64b8 | |
parent | 2f15513e46c57fbf02e93dbaa8b4ff9c79d46620 (diff) |
Port CE symlink to Dockerfiles
This ports all the work of
https://gitlab.com/gitlab-org/gitlab-docs/merge_requests/520
to the Dockerfiles, so that this can be applied to all versions.
-rw-r--r-- | Dockerfile.master | 13 | ||||
-rwxr-xr-x | scripts/normalize-links.sh | 8 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Dockerfile.master b/Dockerfile.master index e306dfe6..5f3b420a 100644 --- a/Dockerfile.master +++ b/Dockerfile.master @@ -1,3 +1,8 @@ +# +# This Dockerfile is mainly used to create the docs:latest image which includes +# the latest 3 stable versions plus the most recent one built from master. +# + # First use the bootstrap image to build master FROM registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap as builder @@ -13,6 +18,13 @@ COPY . /source/ RUN bundle exec rake setup_git default RUN bundle exec nanoc compile -VV +# Symlink all README.html to index.html +RUN for i in `find /source/public/ -name README.html`; do ln -sf README.html $(dirname $i)/index.html; done + +# Remove CE dir and symlink EE to CE +# https://gitlab.com/gitlab-org/gitlab-docs/issues/418 +RUN if [ -d "/source/public/ce/" ]; then cd /source/public/ce && rm -r ce && ln -s ee ce; fi + # Remove tmp dir to save some space RUN rm -rf /source/tmp @@ -27,6 +39,7 @@ ENV TARGET=/usr/share/nginx/html # This hardly ever changes so should usually be cached COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:nginx-onbuild /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf +# Remove default Nginx HTML files RUN rm -rf /usr/share/nginx/html/* # Get all the archive static HTML and put it into place diff --git a/scripts/normalize-links.sh b/scripts/normalize-links.sh index 6189d5bf..3d83ce37 100755 --- a/scripts/normalize-links.sh +++ b/scripts/normalize-links.sh @@ -1,7 +1,7 @@ #!/bin/sh -TARGET="$1" -VER="$2" +TARGET="$1" # usually /site, the directory that has all the HTML files including versions +VER="$2" # the docs version if [ -z "$TARGET" ]; then echo "Usage: $0 <target> <version>" @@ -32,3 +32,7 @@ find ${TARGET} -type f -name 'sitemap.xml' -print0 | xargs -0 sed -i 's#docs.git # Symlink all README.html to index.html for i in `find ${TARGET}/${VER} -name README.html`; do ln -sf README.html $(dirname $i)/index.html; done + +# Remove CE dir and symlink EE to CE +# https://gitlab.com/gitlab-org/gitlab-docs/issues/418 +if [ -d "${TARGET}/${VER}/ce/" ]; then cd ${TARGET}/${VER} && rm -r ce && ln -s ee ce; fi |