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

Dockerfile.master - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a43a235c158280a039ed3a896dd4c104345be10d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
# 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

# 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 master
ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-master}

# Build the docs from this branch
COPY . /source/
RUN yarn install
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

# Compress images
RUN /scripts/compress_images.sh /source/public ee

# Symlink EE to CE
# https://gitlab.com/gitlab-org/gitlab-docs/issues/418
RUN cd /source/public/ && rm -rf ce && ln -s ee ce

# BUILD OF MASTER 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:13.5 ${TARGET} ${TARGET}
COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:13.4 ${TARGET} ${TARGET}
COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:13.3 ${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:12.10 ${TARGET} ${TARGET}
COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:11.11 ${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
CMD echo -e "GitLab docs are viewable at:\nhttp://0.0.0.0:4000"; exec nginx -g 'daemon off;'