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:
authorMarcel Amirault <mamirault@gitlab.com>2020-01-07 11:09:17 +0300
committerMarcel Amirault <mamirault@gitlab.com>2020-01-07 11:09:17 +0300
commit2aa0622c9fac935b9fd61e1f94ceadd5f1aeae6e (patch)
tree7c1c08b73c3d8477f4611b60f429b81cab82bfa2
parent1daf15696429cd676ba5b3216695bdcce8c6df4c (diff)
parent544a2f2da0ccc85c06ce11cea2da4b352ee02008 (diff)
Merge branch 'consolidate-docker-images' into 'master'
Consolidate Docker images See merge request gitlab-org/gitlab-docs!662
-rw-r--r--.gitlab-ci.yml13
-rw-r--r--dockerfiles/Dockerfile.bootstrap22
-rw-r--r--dockerfiles/Dockerfile.gitlab-docs21
-rw-r--r--dockerfiles/Dockerfile.gitlab-docs-base32
-rw-r--r--dockerfiles/Dockerfile.gitlab-docs-lint22
5 files changed, 59 insertions, 51 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aab402d6..629e2a44 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-image: registry.gitlab.com/gitlab-org/gitlab-docs:gitlab-docs
+image: registry.gitlab.com/gitlab-org/gitlab-docs:base
stages:
- build-images
@@ -23,9 +23,8 @@ variables:
# Check Ruby version and install gems
#
before_script:
- - apk add --no-cache build-base bash git xz-dev
- ruby -v
- - bundle install --jobs 4 --path vendor
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install --jobs 4 --path vendor
# Skip this job when it's invoked by a cross project pipeline. That will speed
# up the pipeline when a docs preview is triggered. The triggered pipeline is
@@ -333,19 +332,19 @@ image:docs-lint:
IMAGE_NAME: $CI_REGISTRY_IMAGE:lint
DOCKERFILE: dockerfiles/Dockerfile.gitlab-docs-lint
script:
- - docker build -t $IMAGE_NAME -f $DOCKERFILE .
+ - docker build --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} -t $IMAGE_NAME -f $DOCKERFILE .
- docker push $IMAGE_NAME
when: manual
#
# GitLab docs image
#
-image:gitlab-docs:
+image:gitlab-docs-base:
<<: *docker_prepare
stage: build-images
variables:
- IMAGE_NAME: $CI_REGISTRY_IMAGE:gitlab-docs
- DOCKERFILE: dockerfiles/Dockerfile.gitlab-docs
+ IMAGE_NAME: $CI_REGISTRY_IMAGE:base
+ DOCKERFILE: dockerfiles/Dockerfile.gitlab-docs-base
script:
- docker build -t $IMAGE_NAME -f $DOCKERFILE .
- docker push $IMAGE_NAME
diff --git a/dockerfiles/Dockerfile.bootstrap b/dockerfiles/Dockerfile.bootstrap
index 97a8e756..14f07120 100644
--- a/dockerfiles/Dockerfile.bootstrap
+++ b/dockerfiles/Dockerfile.bootstrap
@@ -1,3 +1,6 @@
+# This is the Nanoc boostrap Dockerfile which builds an image that contains
+# all Nanoc's runtime dependencies and gems.
+
#
# Build minifier utility
# Adapted from https://github.com/docker/docker.github.io/blob/publish-tools/Dockerfile.builder
@@ -9,22 +12,9 @@ RUN export GO111MODULE=on \
&& go build -v -o /minify github.com/tdewolff/minify/cmd/minify
#
-# This is the Nanoc boostrap Dockerfile which builds an image that contains
-# all Nanoc's runtime dependencies and gems.
+# Image that contains all needed dependencies
#
-FROM registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs
-
-# Install packages needed at build and run time
-RUN apk add --no-cache --virtual build-deps \
- build-base \
- ruby-dev \
- libxslt-dev
-
-# Install packages needed at build and run time
-RUN apk add --no-cache libxslt libcurl openssl git grep bash pngquant nodejs
-
-# Do not install rdoc to save some space
-RUN echo 'gem: --no-document' >> /etc/gemrc
+FROM registry.gitlab.com/gitlab-org/gitlab-docs:base
# Copy only Gemfile and Gemfile.lock
COPY /Gemfile* /source/
@@ -37,4 +27,6 @@ RUN NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install --jobs 4
COPY scripts /scripts/
COPY --from=minifier /minify /scripts/minify
+MAINTAINER GitLab Documentation Team
+
CMD echo "Nothing to do here. This is the bootstrap image that contains all dependencies to build the docs site."
diff --git a/dockerfiles/Dockerfile.gitlab-docs b/dockerfiles/Dockerfile.gitlab-docs
deleted file mode 100644
index b16e7e9f..00000000
--- a/dockerfiles/Dockerfile.gitlab-docs
+++ /dev/null
@@ -1,21 +0,0 @@
-FROM ruby:2.6.5-alpine3.10
-MAINTAINER GitLab Documentation Team
-
-ENV YARN_VERSION="1.19.0"
-ENV YARN_ARCHIVE_FILE="yarn-v${YARN_VERSION}.tar.gz"
-ENV YARN_URL="https://yarnpkg.com/downloads/${YARN_VERSION}/${YARN_ARCHIVE_FILE}"
-ENV PATH $PATH:/yarn-v${YARN_VERSION}/bin
-
-# Install dependencies
-RUN apk --no-cache add -U openssl tar gzip xz gnupg bash nodejs \
- && mkdir -p /opt
-
-# Install Yarn
-RUN wget "${YARN_URL}" \
- && wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --import \
- && wget "${YARN_URL}".asc \
- && gpg --verify "${YARN_ARCHIVE_FILE}".asc \
- && tar zvxf "${YARN_ARCHIVE_FILE}"
-
-# Update bundler
-RUN gem install bundler -v "1.17.3"
diff --git a/dockerfiles/Dockerfile.gitlab-docs-base b/dockerfiles/Dockerfile.gitlab-docs-base
new file mode 100644
index 00000000..5e03d3a1
--- /dev/null
+++ b/dockerfiles/Dockerfile.gitlab-docs-base
@@ -0,0 +1,32 @@
+#
+# Image that contains all Nanoc dependencies and tools that
+# are needed to build the docs site and run the tests.
+#
+FROM ruby:2.6.3-alpine3.10
+MAINTAINER GitLab Documentation Team
+
+# Install dependencies
+RUN apk add --no-cache -U \
+ bash \
+ build-base \
+ git \
+ gnupg \
+ gzip \
+ grep \
+ libcurl \
+ libxslt \
+ libxslt-dev \
+ nodejs \
+ openssl \
+ pngquant \
+ ruby-dev \
+ tar \
+ xz \
+ xz-dev \
+ yarn
+
+# Do not install rdoc to save some space
+RUN echo 'gem: --no-document' >> /etc/gemrc
+
+# Update bundler
+RUN gem install bundler -v "1.17.3"
diff --git a/dockerfiles/Dockerfile.gitlab-docs-lint b/dockerfiles/Dockerfile.gitlab-docs-lint
index 3d7f9171..03248264 100644
--- a/dockerfiles/Dockerfile.gitlab-docs-lint
+++ b/dockerfiles/Dockerfile.gitlab-docs-lint
@@ -1,13 +1,19 @@
-FROM ruby:2.6.5-alpine3.10
+#
+# Image the contains the dependencies to run the lints.
+# It downloads the gitlab-docs repository based on the
+# branch the Docker image is invoked from.
+# Based on Alpine.
+#
+FROM registry.gitlab.com/gitlab-org/gitlab-docs:base
MAINTAINER GitLab Documentation Team
-WORKDIR /tmp
+# Set up needed environment variables that are called with --build-arg when
+# the Docker image is built (see .gitlab-ci.yml).
+ARG CI_COMMIT_REF_NAME
+# If CI_COMMIT_REF_NAME is not set (local development), set it to master
+ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-master}
-RUN apk update && apk upgrade && apk add --no-cache \
- build-base \
- bash \
- grep \
- yarn
+WORKDIR /tmp
RUN yarn global add markdownlint-cli && yarn cache clean
@@ -17,4 +23,4 @@ RUN wget https://gitlab.com/gitlab-org/gitlab-docs/-/archive/$CI_COMMIT_REF_NAME
&& rm gitlab-docs-$CI_COMMIT_REF_NAME.tar.bz2
RUN cd gitlab-docs \
- && bundle install --jobs 4
+ && NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install --jobs 4