Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Read <eread@gitlab.com>2022-05-10 17:24:18 +0300
committerSarah German <sgerman@gitlab.com>2022-05-10 17:24:18 +0300
commit1d6e353acc9657522a445863a63fc715d6d676ab (patch)
tree55499cc1d33c40a075a2d57d8498b8a3ae5bbf54 /latest.Dockerfile
parentff79701b2b6ea0d0d61857f80a64da05b62460c3 (diff)
Put Dockerfile file extensions at end of each file
Diffstat (limited to 'latest.Dockerfile')
-rw-r--r--latest.Dockerfile66
1 files changed, 66 insertions, 0 deletions
diff --git a/latest.Dockerfile b/latest.Dockerfile
new file mode 100644
index 00000000..55195aee
--- /dev/null
+++ b/latest.Dockerfile
@@ -0,0 +1,66 @@
+#
+# 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 main.
+#
+
+# First use the bootstrap image to build main
+FROM registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap as builder
+
+# Set up needed environment variables that are called with --build-arg when
+# the Docker image is built (see .gitlab-ci.yml).
+ARG NANOC_ENV
+ARG CI_COMMIT_REF_NAME
+# If CI_COMMIT_REF_NAME is not set (local development), set it to main
+ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-main}
+
+# Build the docs from this branch
+COPY . /source/
+RUN yarn install && \
+ bundle install && \
+ bundle exec rake setup_git default && \
+ bundle exec nanoc compile -VV && \
+ /scripts/compress_images.sh /source/public ee # compress images
+
+# Symlink EE to CE
+# https://gitlab.com/gitlab-org/gitlab-docs/issues/418
+WORKDIR /source/public/
+RUN rm -rf ce && ln -s ee ce
+
+# BUILD OF 'main' DOCS IS NOW DONE!
+
+# Reset to alpine so we don't get any docs source or extra apps
+FROM nginx:1.12-alpine
+
+ENV TARGET=/usr/share/nginx/html
+
+# Get the nginx config from the nginx-onbuild image
+# 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
+# Copy the versions found in 'content/_data/versions.yaml' under online
+COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:14.10 ${TARGET} ${TARGET}
+COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:14.9 ${TARGET} ${TARGET}
+COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:14.8 ${TARGET} ${TARGET}
+
+# List the two last major versions
+# Copy the versions found in 'content/_data/versions.yaml' under previous_majors
+COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:13.12 ${TARGET} ${TARGET}
+COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:12.10 ${TARGET} ${TARGET}
+
+# Get the built docs output from the previous build stage
+# This ordering means all previous layers can come from cache unless an archive
+# changes
+COPY --from=builder /source/public ${TARGET}
+
+# Since we changed images when we invoked 'FROM nginx:1.12-alpine' above,
+# the minify script and binary are not included. Thus, we copy them from the
+# previous image (aliased as builder).
+COPY --from=builder /scripts/minify* /scripts/
+
+# Serve the site (target), which is now all static HTML
+# hadolint ignore=DL3025
+CMD echo -e "GitLab docs are viewable at:\nhttp://0.0.0.0:4000"; exec nginx -g 'daemon off;'