diff --git a/.dockerignore b/.dockerignore index ce783a50541..0833b243a6f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ .gitignore Dockerfile docker-compose.yml +_site diff --git a/Dockerfile b/Dockerfile index 277cf7e8aed..12001648801 100644 --- a/Dockerfile +++ b/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 diff --git a/Gemfile b/Gemfile index 855387d549d..314f981510e 100644 --- a/Gemfile +++ b/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 diff --git a/_data/docsarchive/archive.yml b/_data/docsarchive/archive.yml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/_data/docsarchive/docs-base/Dockerfile b/_data/docsarchive/docs-base/Dockerfile new file mode 100644 index 00000000000..40e9d523e3c --- /dev/null +++ b/_data/docsarchive/docs-base/Dockerfile @@ -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 diff --git a/_data/docsarchive/docs-base/index.html b/_data/docsarchive/docs-base/index.html new file mode 100644 index 00000000000..40d181eca68 --- /dev/null +++ b/_data/docsarchive/docs-base/index.html @@ -0,0 +1,16 @@ + + +

Docs archive

+ + + diff --git a/_data/docsarchive/docs-base/nginx.conf b/_data/docsarchive/docs-base/nginx.conf new file mode 100644 index 00000000000..1c0e89b1a00 --- /dev/null +++ b/_data/docsarchive/docs-base/nginx.conf @@ -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; + } +} diff --git a/_data/docsarchive/v1.10/Dockerfile b/_data/docsarchive/v1.10/Dockerfile deleted file mode 100644 index 8baa1ae57d9..00000000000 --- a/_data/docsarchive/v1.10/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.11/Dockerfile b/_data/docsarchive/v1.11/Dockerfile deleted file mode 100644 index 2d339636275..00000000000 --- a/_data/docsarchive/v1.11/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.4/Dockerfile b/_data/docsarchive/v1.4/Dockerfile deleted file mode 100644 index 9d03f7f85ba..00000000000 --- a/_data/docsarchive/v1.4/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.5/Dockerfile b/_data/docsarchive/v1.5/Dockerfile deleted file mode 100644 index 038dd020a1f..00000000000 --- a/_data/docsarchive/v1.5/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.6/Dockerfile b/_data/docsarchive/v1.6/Dockerfile deleted file mode 100644 index fe98774588c..00000000000 --- a/_data/docsarchive/v1.6/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.7/Dockerfile b/_data/docsarchive/v1.7/Dockerfile deleted file mode 100644 index 74445638b17..00000000000 --- a/_data/docsarchive/v1.7/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.8/Dockerfile b/_data/docsarchive/v1.8/Dockerfile deleted file mode 100644 index 73110f4720c..00000000000 --- a/_data/docsarchive/v1.8/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/v1.9/Dockerfile b/_data/docsarchive/v1.9/Dockerfile deleted file mode 100644 index ff57967c234..00000000000 --- a/_data/docsarchive/v1.9/Dockerfile +++ /dev/null @@ -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"] diff --git a/_data/docsarchive/vnext-compose/Dockerfile b/_data/docsarchive/vnext-compose/Dockerfile deleted file mode 100644 index aff08596f90..00000000000 --- a/_data/docsarchive/vnext-compose/Dockerfile +++ /dev/null @@ -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 diff --git a/_data/docsarchive/vnext-distribution/Dockerfile b/_data/docsarchive/vnext-distribution/Dockerfile deleted file mode 100644 index 8461f31668b..00000000000 --- a/_data/docsarchive/vnext-distribution/Dockerfile +++ /dev/null @@ -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 diff --git a/_data/docsarchive/vnext-engine/Dockerfile b/_data/docsarchive/vnext-engine/Dockerfile deleted file mode 100644 index 659b48723f1..00000000000 --- a/_data/docsarchive/vnext-engine/Dockerfile +++ /dev/null @@ -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 diff --git a/_data/docsarchive/vnext-kitematic/Dockerfile b/_data/docsarchive/vnext-kitematic/Dockerfile deleted file mode 100644 index 60b61b64286..00000000000 --- a/_data/docsarchive/vnext-kitematic/Dockerfile +++ /dev/null @@ -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 diff --git a/_data/docsarchive/vnext-machine/Dockerfile b/_data/docsarchive/vnext-machine/Dockerfile deleted file mode 100644 index ffb099e5d45..00000000000 --- a/_data/docsarchive/vnext-machine/Dockerfile +++ /dev/null @@ -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 diff --git a/_data/docsarchive/vnext-toolbox/Dockerfile b/_data/docsarchive/vnext-toolbox/Dockerfile deleted file mode 100644 index bda048ae6e9..00000000000 --- a/_data/docsarchive/vnext-toolbox/Dockerfile +++ /dev/null @@ -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 diff --git a/_data/staging-container/Dockerfile b/_data/staging-container/Dockerfile index a4e6b230785..8fdfe6ddb01 100644 --- a/_data/staging-container/Dockerfile +++ b/_data/staging-container/Dockerfile @@ -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 \ No newline at end of file +CMD jekyll serve -d /_site --watch -H 0.0.0.0 -P 4000