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:
authorRussell Dickenson <rdickenson@gitlab.com>2022-06-23 07:53:00 +0300
committerRussell Dickenson <rdickenson@gitlab.com>2022-06-23 07:53:00 +0300
commit6d1db196eef964dabe82b94adb4ab6f9ec468392 (patch)
treee1ee259481ed67e2cc9be656d8388258e9af1cc8
parentcc2ffab014b4f612b0bbb2b8759601f58f2ed69d (diff)
parentc81a3169acf562c1555bf79cef433e3e4d9cc928 (diff)
Merge branch 'eread/update-latest-dockerfile-for-new-image' into 'main'
Move latest.Dockerfile away from deprecated bootstrap image See merge request gitlab-org/gitlab-docs!2851
-rw-r--r--.gitlab/ci/docker-images.gitlab-ci.yml18
-rw-r--r--latest.Dockerfile23
2 files changed, 35 insertions, 6 deletions
diff --git a/.gitlab/ci/docker-images.gitlab-ci.yml b/.gitlab/ci/docker-images.gitlab-ci.yml
index 9263b7d5..7b9214c1 100644
--- a/.gitlab/ci/docker-images.gitlab-ci.yml
+++ b/.gitlab/ci/docker-images.gitlab-ci.yml
@@ -269,3 +269,21 @@ image:docs-latest:
script:
- docker build --build-arg NANOC_ENV=${NANOC_ENV} --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} -t $IMAGE_NAME -f $DOCKERFILE .
- docker push $IMAGE_NAME
+
+#
+# Test the GitLab docs single version Docker image if changes made to its Dockerfile
+#
+test:image:docs-latest:
+ extends:
+ - .docker_prepare
+ stage: test
+ variables:
+ IMAGE_NAME: $CI_REGISTRY_IMAGE:latest
+ DOCKERFILE: latest.Dockerfile
+ needs: []
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ changes:
+ - $DOCKERFILE
+ script:
+ - docker build --build-arg NANOC_ENV=${NANOC_ENV} --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} -t $IMAGE_NAME -f $DOCKERFILE .
diff --git a/latest.Dockerfile b/latest.Dockerfile
index e565ee7e..98cfba58 100644
--- a/latest.Dockerfile
+++ b/latest.Dockerfile
@@ -4,7 +4,7 @@
#
# First use the bootstrap image to build main
-FROM registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap as builder
+FROM registry.gitlab.com/gitlab-org/gitlab-docs/base:alpine-3.16-ruby-2.7.6-0bc327a4 as builder
# Set up needed environment variables that are called with --build-arg when
# the Docker image is built (see .gitlab-ci.yml).
@@ -15,11 +15,16 @@ ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-main}
# Build the docs from this branch
COPY . /source/
+# Copy only the Gemfiles and yarn.lock to install the dependencies
+COPY /Gemfile* /source/
+COPY /yarn.lock /source/
+WORKDIR /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
+ scripts/compress_images.sh public ee # compress images
# Symlink EE to CE
# https://gitlab.com/gitlab-org/gitlab-docs/issues/418
@@ -56,10 +61,16 @@ COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:13.12 ${TARGET} ${TARGET}
# 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/
+# Build minifier utility
+# Adapted from https://github.com/docker/docker.github.io/blob/publish-tools/Dockerfile.builder
+#
+FROM golang:1.13-alpine AS minifier
+RUN apk add --no-cache git
+RUN export GO111MODULE=on \
+ && go get -d github.com/tdewolff/minify/v2@latest \
+ && go build -v -o /minify github.com/tdewolff/minify/cmd/minify
+WORKDIR /source
+COPY /scripts/minify* scripts/
# Serve the site (target), which is now all static HTML
CMD ["sh", "-c", "echo 'GitLab docs are viewable at: http://0.0.0.0:4000'; exec nginx -g 'daemon off;'"]