mirror of
https://github.com/docker/docs.git
synced 2026-03-27 06:18:55 +07:00
Move to GHP 112, nginx-based server, docs-base (#1515)
* Moves to GHP 112, nginx-based server * Import official nginx instructions per @thaJeztah * Reordering of commands per @thaJeztah * Reordering of commands per @thaJeztah * Make sure that at the end of each layer we only keep the one directory * Forgot to use md_source when resolving conflicts * Update Dockerfile * Use base image, clean up cruft from docsarchive folder * Update docs-base to be self-browseable, conf source of truth
This commit is contained in:
@@ -3,3 +3,4 @@
|
||||
.gitignore
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
_site
|
||||
|
||||
82
Dockerfile
82
Dockerfile
@@ -1,53 +1,45 @@
|
||||
FROM starefossen/github-pages
|
||||
FROM docs/docs-base
|
||||
|
||||
ENV VERSIONS="v1.4 v1.5 v1.6 v1.7 v1.8 v1.9 v1.10 v1.11 v1.12"
|
||||
# docs-base contains: GitHub Pages, nginx, and the docs archives, running on
|
||||
# Debian Jesse. See the Dockerfile for docs-base at:
|
||||
# _data/docsarchive/docs-base in the docs repo
|
||||
|
||||
# Create archive; check out each version, create HTML, tweak links
|
||||
RUN git clone https://www.github.com/docker/docker.github.io temp; \
|
||||
for VER in $VERSIONS; do \
|
||||
git --git-dir=./temp/.git --work-tree=./temp checkout ${VER} \
|
||||
&& mkdir -p allvbuild/${VER} \
|
||||
&& jekyll build -s temp -d allvbuild/${VER} \
|
||||
&& find allvbuild/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="/#href="/'"$VER"'/#g' \
|
||||
&& find allvbuild/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#src="/#src="/'"$VER"'/#g' \
|
||||
&& find allvbuild/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="https://docs.docker.com/#href="/'"$VER"'/#g'; \
|
||||
done; \
|
||||
rm -rf temp
|
||||
# Copy master into target directory (skipping files / folders in .dockerignore)
|
||||
# These files represent the current docs
|
||||
COPY . md_source
|
||||
|
||||
COPY . allv
|
||||
# Move built html into md_source directory so we can reuse the target directory
|
||||
# to hold the static output.
|
||||
# Pull reference docs from upstream locations, then build the master docs
|
||||
# into static HTML in the "target" directory using Jekyll
|
||||
# then nuke the md_source directory.
|
||||
|
||||
## Branch to pull from, per ref doc
|
||||
ENV ENGINE_BRANCH="1.13.x"
|
||||
ENV DISTRIBUTION_BRANCH="release/2.5"
|
||||
|
||||
# The statements below pull reference docs from upstream locations,
|
||||
# then build the whole site to static HTML using Jekyll
|
||||
|
||||
RUN svn co https://github.com/docker/docker/branches/$ENGINE_BRANCH/docs/extend allv/engine/extend \
|
||||
&& wget -O allv/engine/api/v1.18.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.18.md \
|
||||
&& wget -O allv/engine/api/v1.19.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.19.md \
|
||||
&& wget -O allv/engine/api/v1.20.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.20.md \
|
||||
&& wget -O allv/engine/api/v1.21.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.21.md \
|
||||
&& wget -O allv/engine/api/v1.22.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.22.md \
|
||||
&& wget -O allv/engine/api/v1.23.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.23.md \
|
||||
&& wget -O allv/engine/api/v1.24.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.24.md \
|
||||
&& wget -O allv/engine/api/version-history.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/version-history.md \
|
||||
&& wget -O allv/engine/reference/glossary.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/glossary.md \
|
||||
&& wget -O allv/engine/reference/builder.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/builder.md \
|
||||
&& wget -O allv/engine/reference/run.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/run.md \
|
||||
&& wget -O allv/engine/reference/commandline/cli.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/commandline/cli.md \
|
||||
&& wget -O allv/engine/deprecated.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/deprecated.md \
|
||||
&& svn co https://github.com/docker/distribution/branches/$DISTRIBUTION_BRANCH/docs/spec allv/registry/spec \
|
||||
&& rm allv/registry/spec/api.md.tmpl \
|
||||
&& wget -O allv/registry/configuration.md https://raw.githubusercontent.com/docker/distribution/$DISTRIBUTION_BRANCH/docs/configuration.md \
|
||||
&& rm -rf allv/apidocs/cloud-api-source \
|
||||
&& rm -rf allv/tests \
|
||||
&& wget -O allv/engine/api/v1.25/swagger.yaml https://raw.githubusercontent.com/docker/docker/v1.13.0/api/swagger.yaml \
|
||||
&& wget -O allv/engine/api/v1.26/swagger.yaml https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/api/swagger.yaml \
|
||||
&& jekyll build -s allv -d allvbuild \
|
||||
&& rm -rf allvbuild/apidocs/layouts \
|
||||
&& find allvbuild -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="https://docs.docker.com/#href="/#g' \
|
||||
&& rm -rf allv
|
||||
|
||||
# Serve the site, which is now all static HTML
|
||||
CMD jekyll serve -s /usr/src/app/allvbuild --no-watch -H 0.0.0.0 -P 4000
|
||||
RUN svn co https://github.com/docker/docker/branches/$ENGINE_BRANCH/docs/extend md_source/engine/extend \
|
||||
&& wget -O md_source/engine/api/v1.18.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.18.md \
|
||||
&& wget -O md_source/engine/api/v1.19.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.19.md \
|
||||
&& wget -O md_source/engine/api/v1.20.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.20.md \
|
||||
&& wget -O md_source/engine/api/v1.21.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.21.md \
|
||||
&& wget -O md_source/engine/api/v1.22.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.22.md \
|
||||
&& wget -O md_source/engine/api/v1.23.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.23.md \
|
||||
&& wget -O md_source/engine/api/v1.24.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/v1.24.md \
|
||||
&& wget -O md_source/engine/api/version-history.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/api/version-history.md \
|
||||
&& wget -O md_source/engine/reference/glossary.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/glossary.md \
|
||||
&& wget -O md_source/engine/reference/builder.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/builder.md \
|
||||
&& wget -O md_source/engine/reference/run.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/run.md \
|
||||
&& wget -O md_source/engine/reference/commandline/cli.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/reference/commandline/cli.md \
|
||||
&& wget -O md_source/engine/deprecated.md https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/docs/deprecated.md \
|
||||
&& svn co https://github.com/docker/distribution/branches/$DISTRIBUTION_BRANCH/docs/spec md_source/registry/spec \
|
||||
&& rm md_source/registry/spec/api.md.tmpl \
|
||||
&& wget -O md_source/registry/configuration.md https://raw.githubusercontent.com/docker/distribution/$DISTRIBUTION_BRANCH/docs/configuration.md \
|
||||
&& rm -rf md_source/apidocs/cloud-api-source \
|
||||
&& rm -rf md_source/tests \
|
||||
&& wget -O md_source/engine/api/v1.25/swagger.yaml https://raw.githubusercontent.com/docker/docker/v1.13.0/api/swagger.yaml \
|
||||
&& wget -O md_source/engine/api/v1.26/swagger.yaml https://raw.githubusercontent.com/docker/docker/$ENGINE_BRANCH/api/swagger.yaml \
|
||||
&& jekyll build -s md_source -d target \
|
||||
&& rm -rf target/apidocs/layouts \
|
||||
&& find target -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="https://docs.docker.com/#href="/#g' \
|
||||
&& rm -rf md_source
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -1,3 +1,3 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "github-pages", "105" #Update me once in a while: https://github.com/github/pages-gem/releases
|
||||
gem "github-pages", "112" #Update me once in a while: https://github.com/github/pages-gem/releases
|
||||
|
||||
51
_data/docsarchive/docs-base/Dockerfile
Normal file
51
_data/docsarchive/docs-base/Dockerfile
Normal file
@@ -0,0 +1,51 @@
|
||||
FROM starefossen/github-pages:112
|
||||
|
||||
# This is the source for docs/docs-base. Push to that location to ensure that
|
||||
# the production image gets your update :)
|
||||
|
||||
# Install nginx
|
||||
|
||||
ENV NGINX_VERSION 1.11.9-1~jessie
|
||||
|
||||
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
|
||||
&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
||||
ca-certificates \
|
||||
nginx=${NGINX_VERSION} \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Forward nginx request and error logs to docker log collector
|
||||
|
||||
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
||||
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
## At the end of each layer, everything we need to pass on to the next layer
|
||||
## should be in the "target" directory and we should have removed all temporary files
|
||||
|
||||
# Create archive; check out each version, create HTML under target/$VER, tweak links
|
||||
# Nuke the archive_source directory. Only keep the target directory.
|
||||
|
||||
ENV VERSIONS="v1.4 v1.5 v1.6 v1.7 v1.8 v1.9 v1.10 v1.11 v1.12"
|
||||
|
||||
RUN git clone https://www.github.com/docker/docker.github.io archive_source; \
|
||||
for VER in $VERSIONS; do \
|
||||
git --git-dir=./archive_source/.git --work-tree=./archive_source checkout ${VER} \
|
||||
&& mkdir -p target/${VER} \
|
||||
&& jekyll build -s archive_source -d target/${VER} \
|
||||
&& find target/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="/#href="/'"$VER"'/#g' \
|
||||
&& find target/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#src="/#src="/'"$VER"'/#g' \
|
||||
&& find target/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="https://docs.docker.com/#href="/'"$VER"'/#g'; \
|
||||
done; \
|
||||
rm -rf archive_source
|
||||
|
||||
# This index file gets overwritten, but it serves a sort-of useful purpose in
|
||||
# making the docs/docs-base image browsable:
|
||||
|
||||
COPY index.html target
|
||||
|
||||
# Serve the site (target), which is now all static HTML
|
||||
|
||||
CMD echo "Docker docs are viewable at:" && echo "http://0.0.0.0:4000" && exec nginx
|
||||
16
_data/docsarchive/docs-base/index.html
Normal file
16
_data/docsarchive/docs-base/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Docs archive</h1>
|
||||
<ul>
|
||||
<li><a href="/v1.4">v1.4</a></li>
|
||||
<li><a href="/v1.5">v1.5</a></li>
|
||||
<li><a href="/v1.6">v1.6</a></li>
|
||||
<li><a href="/v1.7">v1.7</a></li>
|
||||
<li><a href="/v1.8">v1.8</a></li>
|
||||
<li><a href="/v1.9">v1.9</a></li>
|
||||
<li><a href="/v1.10">v1.10</a></li>
|
||||
<li><a href="/v1.11">v1.11</a></li>
|
||||
<li><a href="/v1.12">v1.12</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
16
_data/docsarchive/docs-base/nginx.conf
Normal file
16
_data/docsarchive/docs-base/nginx.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
worker_processes 1;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
root /usr/src/app/target;
|
||||
location / {
|
||||
include /etc/nginx/mime.types;
|
||||
}
|
||||
listen 4000;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.10
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.11
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.4
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.5
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.6
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.7
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.8
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM starefossen/ruby-node:2-5
|
||||
|
||||
RUN gem install github-pages
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
RUN git clone https://github.com/docker/docker.github.io docs
|
||||
|
||||
WORKDIR /data/docs
|
||||
|
||||
RUN git checkout v1.9
|
||||
|
||||
RUN jekyll build
|
||||
|
||||
ENTRYPOINT ["jekyll", "serve", "--host=0.0.0.0"]
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
FROM starefossen/github-pages:onbuild
|
||||
|
||||
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
|
||||
|
||||
ONBUILD WORKDIR docs
|
||||
|
||||
ONBUILD RUN git checkout vnext-compose
|
||||
|
||||
ONBUILD COPY . /usr/src/app
|
||||
|
||||
CMD jekyll serve -d /_site -H 0.0.0.0 -P 4000
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
FROM starefossen/github-pages:onbuild
|
||||
|
||||
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
|
||||
|
||||
ONBUILD WORKDIR docs
|
||||
|
||||
ONBUILD RUN git checkout vnext-distribution
|
||||
|
||||
ONBUILD COPY . /usr/src/app
|
||||
|
||||
CMD jekyll serve -d /_site -H 0.0.0.0 -P 4000
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
FROM starefossen/github-pages:onbuild
|
||||
|
||||
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
|
||||
|
||||
ONBUILD WORKDIR docs
|
||||
|
||||
ONBUILD RUN git checkout vnext-engine
|
||||
|
||||
ONBUILD COPY . /usr/src/app
|
||||
|
||||
CMD jekyll serve -d /_site -H 0.0.0.0 -P 4000
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
FROM starefossen/github-pages:onbuild
|
||||
|
||||
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
|
||||
|
||||
ONBUILD WORKDIR docs
|
||||
|
||||
ONBUILD RUN git checkout vnext-kitematic
|
||||
|
||||
ONBUILD COPY . /usr/src/app
|
||||
|
||||
CMD jekyll serve -d /_site -H 0.0.0.0 -P 4000
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
FROM starefossen/github-pages:onbuild
|
||||
|
||||
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
|
||||
|
||||
ONBUILD WORKDIR docs
|
||||
|
||||
ONBUILD RUN git checkout vnext-machine
|
||||
|
||||
ONBUILD COPY . /usr/src/app
|
||||
|
||||
CMD jekyll serve -d /_site -H 0.0.0.0 -P 4000
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
FROM starefossen/github-pages:onbuild
|
||||
|
||||
ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs
|
||||
|
||||
ONBUILD WORKDIR docs
|
||||
|
||||
ONBUILD RUN git checkout vnext-toolbox
|
||||
|
||||
ONBUILD COPY . /usr/src/app
|
||||
|
||||
CMD jekyll serve -d /_site -H 0.0.0.0 -P 4000
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM starefossen/github-pages:onbuild
|
||||
FROM starefossen/github-pages:112
|
||||
|
||||
VOLUME /usr/src/app
|
||||
|
||||
EXPOSE 4000
|
||||
|
||||
CMD jekyll serve -d /_site --watch -H 0.0.0.0 -P 4000
|
||||
CMD jekyll serve -d /_site --watch -H 0.0.0.0 -P 4000
|
||||
|
||||
Reference in New Issue
Block a user