Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go back to small /edge #2736

Merged
merged 5 commits into from
Apr 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move logic of fetching content to a script
  • Loading branch information
Misty Stanley-Jones committed Apr 13, 2017
commit 69b34fde48c33e372c5654b3240624d6afecac81
42 changes: 3 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,52 +19,16 @@ COPY . md_source
## Branch to pull from, per ref doc
## To get master from svn the svn branch needs to be 'trunk'. To get a branch from svn it needs to be 'branches/branchname'

# Engine stable
# Engine
ENV ENGINE_SVN_BRANCH="branches/17.03.x"
ENV ENGINE_BRANCH="17.03.x"
# Engine edge
ENV ENGINE_EDGE_SVN_BRANCH="branches/17.04.x"
ENV ENGINE_EDGE_BRANCH="17.04.x"

# Distribution
ENV DISTRIBUTION_SVN_BRANCH="branches/release/2.6"
ENV DISTRIBUTION_BRANCH="release/2.6"

RUN svn co https://github.com/docker/docker/$ENGINE_SVN_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/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/v17.03.0-ce/api/swagger.yaml \
&& wget -O md_source/engine/api/v1.27/swagger.yaml https://raw.githubusercontent.com/docker/docker/v17.03.1-ce/api/swagger.yaml \
\
&& mkdir -p md_source/edge/engine/api/v1.28 \
&& wget -O md_source/edge/engine/api/v1.28/swagger.yaml https://raw.githubusercontent.com/docker/docker/v17.04.0-ce/api/swagger.yaml \
\
&& 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/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 \
\
&& wget -O md_source/edge/engine/api/version-history.md https://raw.githubusercontent.com/docker/docker/$ENGINE_EDGE_BRANCH/docs/api/version-history.md \
&& wget -O md_source/edge/engine/reference/builder.md https://raw.githubusercontent.com/docker/docker/$ENGINE_EDGE_BRANCH/docs/reference/builder.md \
&& wget -O md_source/edge/engine/reference/run.md https://raw.githubusercontent.com/docker/docker/$ENGINE_EDGE_BRANCH/docs/reference/run.md \
&& wget -O md_source/edge/engine/reference/commandline/cli.md https://raw.githubusercontent.com/docker/docker/$ENGINE_EDGE_BRANCH/docs/reference/commandline/cli.md \
&& wget -O md_source/edge/engine/deprecated.md https://raw.githubusercontent.com/docker/docker/$ENGINE_EDGE_BRANCH/docs/deprecated.md \
\
&& svn co https://github.com/docker/distribution/$DISTRIBUTION_SVN_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 \
\
RUN md_source/_scripts/fetch-upstream-resources.sh \
&& jekyll build -s md_source -d target --config md_source/_config.yml \
\
&& 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
42 changes: 42 additions & 0 deletions _scripts/fetch-upstream-resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Fetches upstream resources from docker/docker and docker/distribution
# before handing off the site to Jekyll to build
# Relies on the following environment variables which are usually set by
# the Dockerfile. Uncomment them here to override for debugging

# Engine stable
ENGINE_SVN_BRANCH="branches/17.03.x"
ENGINE_BRANCH="17.03.x"

# Distribution
DISTRIBUTION_SVN_BRANCH="branches/release/2.6"
DISTRIBUTION_BRANCH="release/2.6"

# Directories to get via SVN. We use this because you can't use git to clone just a portion of a repository
svn co https://github.com/docker/docker/"$ENGINE_SVN_BRANCH"/docs/extend md_source/engine/extend || (echo "Failed engine/extend download" && exit -1)
svn co https://github.com/docker/docker/"$ENGINE_SVN_BRANCH"/docs/api md_source/engine/api || (echo "Failed engine/api download" && exit -1) # This will only get you the old API MD files 1.18 through 1.24
svn co https://github.com/docker/distribution/"$DISTRIBUTION_SVN_BRANCH"/docs/spec md_source/registry/spec || (echo "Failed registry/spec download" && exit -1)


# Get the Engine APIs that are in Swagger
# Be careful with the locations on Github for these
wget -O md_source/engine/api/v1.25/swagger.yaml https://raw.githubusercontent.com/docker/docker/v1.13.0/api/swagger.yaml || (echo "Failed 1.25 swagger download" && exit -1)
wget -O md_source/engine/api/v1.26/swagger.yaml https://raw.githubusercontent.com/docker/docker/v17.03.0-ce/api/swagger.yaml || (echo "Failed 1.26 swagger download" && exit -1)
wget -O md_source/engine/api/v1.27/swagger.yaml https://raw.githubusercontent.com/docker/docker/v17.03.1-ce/api/swagger.yaml || (echo "Failed 1.27 swagger download" && exit -1)

# Get the Edge API Swagger (it goes to a slightly different location)
mkdir -p md_source/edge/engine/api/v1.28 \
&& wget -O md_source/edge/engine/api/v1.28/swagger.yaml https://raw.githubusercontent.com/docker/docker/v17.04.0-ce/api/swagger.yaml || (echo "Failed 1.28 swagger download" && exit -1)

# Get a few one-off files that we use directly from upstream
wget -O md_source/engine/reference/builder.md https://raw.githubusercontent.com/docker/docker/"$ENGINE_BRANCH"/docs/reference/builder.md || (echo "Failed engine/reference/builder.md download" && exit -1)
wget -O md_source/engine/reference/run.md https://raw.githubusercontent.com/docker/docker/"$ENGINE_BRANCH"/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit -1)
wget -O md_source/engine/reference/commandline/cli.md https://raw.githubusercontent.com/docker/docker/"$ENGINE_BRANCH"/docs/reference/commandline/cli.md || (echo "Failed engine/reference/commandline/cli.md download" && exit -1)
wget -O md_source/engine/deprecated.md https://raw.githubusercontent.com/docker/docker/"$ENGINE_BRANCH"/docs/deprecated.md || (echo "Failed engine/deprecated.md download" && exit -1)
wget -O md_source/registry/configuration.md https://raw.githubusercontent.com/docker/distribution/"$DISTRIBUTION_BRANCH"/docs/configuration.md || (echo "Failed registry/configuration.md download" && exit -1)

# Remove things we don't want in the build
rm md_source/registry/spec/api.md.tmpl
rm -rf md_source/apidocs/cloud-api-source
rm -rf md_source/tests