mirror of https://github.com/docker/docs.git
Remove scripts and assets related to archives
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
48bfa8f342
commit
ba85012f47
48
Dockerfile
48
Dockerfile
|
@ -3,11 +3,10 @@
|
|||
#
|
||||
# Here is the sequence:
|
||||
# 1. Set up base stages for building and deploying
|
||||
# 2. Collect and build the archived documentation
|
||||
# 3. Collect and build the reference documentation (from upstream resources)
|
||||
# 4. Build static HTML from the current branch
|
||||
# 5. Build the final image, combining the archives, reference docs, and
|
||||
# current version of the documentation
|
||||
# 2. Collect and build the reference documentation (from upstream resources)
|
||||
# 3. Build static HTML from the current branch
|
||||
# 4. Build the final image, combining the reference docs and current version
|
||||
# of the documentation
|
||||
#
|
||||
# When the image is run, it starts Nginx and serves the docs at port 4000
|
||||
|
||||
|
@ -18,9 +17,6 @@ ARG ENGINE_BRANCH="19.03"
|
|||
# Distribution
|
||||
ARG DISTRIBUTION_BRANCH="release/2.7"
|
||||
|
||||
# Set to "false" to build the documentation without archives
|
||||
ARG ENABLE_ARCHIVES=false
|
||||
|
||||
###
|
||||
# Set up base stages for building and deploying
|
||||
###
|
||||
|
@ -36,22 +32,6 @@ ENV ENGINE_BRANCH=${ENGINE_BRANCH}
|
|||
ARG DISTRIBUTION_BRANCH
|
||||
ENV DISTRIBUTION_BRANCH=${DISTRIBUTION_BRANCH}
|
||||
|
||||
|
||||
# Empty stage if archives are disabled (ENABLE_ARCHIVES=false)
|
||||
FROM scratch AS archives-false
|
||||
|
||||
# Stage with static HTML for all archives (ENABLE_ARCHIVES=true)
|
||||
FROM scratch AS archives-true
|
||||
ENV TARGET=/usr/share/nginx/html
|
||||
# To add a new archive, add it here and ALSO edit _data/docsarchive/archives.yaml
|
||||
# to add it to the drop-down
|
||||
COPY --from=docs/docker.github.io:v17.06 ${TARGET} /
|
||||
COPY --from=docs/docker.github.io:v18.03 ${TARGET} /
|
||||
COPY --from=docs/docker.github.io:v18.09 ${TARGET} /
|
||||
|
||||
# Stage either with, or without archives, depending on ENABLE_ARCHIVES
|
||||
FROM archives-${ENABLE_ARCHIVES} AS archives
|
||||
|
||||
# Fetch upstream resources (reference documentation)
|
||||
# Only add the files that are needed to build these reference docs, so that these
|
||||
# docs are only rebuilt if changes were made to ENGINE_BRANCH or DISTRIBUTION_BRANCH.
|
||||
|
@ -66,7 +46,7 @@ RUN ./_scripts/fetch-upstream-resources.sh .
|
|||
|
||||
|
||||
# Build the static HTML for the current docs.
|
||||
# After building with jekyll, fix up some links, but don't touch the archives
|
||||
# After building with jekyll, fix up some links
|
||||
FROM builderbase AS current
|
||||
COPY . .
|
||||
COPY --from=upstream-resources /usr/src/app/md_source/. ./
|
||||
|
@ -74,7 +54,7 @@ COPY --from=upstream-resources /usr/src/app/md_source/. ./
|
|||
# API docs, based on the latest_engine_api_version parameter in _config.yml
|
||||
RUN ./_scripts/update-api-toc.sh
|
||||
RUN jekyll build -d ${TARGET} \
|
||||
&& find ${TARGET} -type f -name '*.html' | grep -vE "v[0-9]+\." | while read i; do sed -i 's#href="https://docs.docker.com/#href="/#g' "$i"; done
|
||||
&& find ${TARGET} -type f -name '*.html' | while read i; do sed -i 's#href="https://docs.docker.com/#href="/#g' "$i"; done
|
||||
|
||||
|
||||
# This stage only contains the generated files. It can be used to host the
|
||||
|
@ -82,28 +62,18 @@ RUN jekyll build -d ${TARGET} \
|
|||
# When using BuildKit, use the '--output' option to build the files and to copy
|
||||
# them to your local filesystem.
|
||||
#
|
||||
# To build current docs, including archives:
|
||||
# DOCKER_BUILDKIT=1 docker build --target=deploy-source --output=./_site .
|
||||
#
|
||||
# To build without archives:
|
||||
# DOCKER_BUILDKIT=1 docker build --target=deploy-source --build-arg ENABLE_ARCHIVES=false --output=./_site .
|
||||
FROM archives AS deploy-source
|
||||
FROM scratch AS deploy-source
|
||||
COPY --from=current /usr/share/nginx/html /
|
||||
|
||||
# Final stage, which includes nginx, and, depending on ENABLE_ARCHIVES, either
|
||||
# current docs and archived versions (ENABLE_ARCHIVES=true), or only the current
|
||||
# docs (ENABLE_ARCHIVES=false).
|
||||
# Final stage, which includes nginx, and the current docs.
|
||||
#
|
||||
# To build current docs, including archives:
|
||||
# To build current docs:
|
||||
# DOCKER_BUILDKIT=1 docker build -t docs .
|
||||
#
|
||||
# To build without archives:
|
||||
# DOCKER_BUILDKIT=1 docker build -t docs --build-arg ENABLE_ARCHIVES=false .
|
||||
FROM nginx:alpine AS deploy
|
||||
ENV TARGET=/usr/share/nginx/html
|
||||
WORKDIR $TARGET
|
||||
|
||||
COPY --from=archives / .
|
||||
COPY --from=current /usr/share/nginx/html .
|
||||
|
||||
# Configure NGINX
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Set to the version for this archive
|
||||
ARG VER=vXX
|
||||
|
||||
# This image comes from the Dockerfile.onbuild file in the docs-builder branch
|
||||
# https://github.com/docker/docker.github.io/blob/docs-builder/Dockerfile.onbuild
|
||||
FROM docs/docker.github.io:docs-builder-onbuild AS builder
|
||||
|
||||
# Reset the docs:onbuild image, which is based on nginx:alpine
|
||||
# This image comes from the Dockerfile in the nginx-onbuild branch
|
||||
# https://github.com/docker/docker.github.io/blob/nginx-onbuild/Dockerfile
|
||||
FROM docs/docker.github.io:nginx-onbuild
|
190
README.md
190
README.md
|
@ -10,9 +10,8 @@ open source and we deeply appreciate contributions from our community!
|
|||
- [Contributing](#contributing)
|
||||
- [Files not edited here](#files-not-edited-here)
|
||||
- [Overall doc improvements](#overall-doc-improvements)
|
||||
- [Specific new features for a project](#specific-new-features-for-a-project)
|
||||
- [Per-PR staging on GitHub](#per-pr-staging-on-github)
|
||||
- [Staging the docs](#staging-the-docs)
|
||||
- [Build the docs locally](#build-the-docs-locally)
|
||||
- [Read these docs offline](#read-these-docs-offline)
|
||||
- [Important files](#important-files)
|
||||
- [Relative linking for GitHub viewing](#relative-linking-for-github-viewing)
|
||||
|
@ -21,10 +20,6 @@ open source and we deeply appreciate contributions from our community!
|
|||
- [Creating tabs](#creating-tabs)
|
||||
- [Running in-page Javascript](#running-in-page-javascript)
|
||||
- [Images](#images)
|
||||
- [Beta content disclaimer](#beta-content-disclaimer)
|
||||
- [Accessing unsupported archived documentation](#accessing-unsupported-archived-documentation)
|
||||
- [Building archives and the live published docs](#building-archives-and-the-live-published-docs)
|
||||
- [Creating a new archive](#creating-a-new-archive)
|
||||
- [Copyright and license](#copyright-and-license)
|
||||
|
||||
|
||||
|
@ -68,66 +63,26 @@ in the `source:` key in the YAML file.
|
|||
|
||||
### Overall doc improvements
|
||||
|
||||
Most commits will be made against the `master` branch. This include:
|
||||
Pull requests should be opened against the `master` branch, this includes:
|
||||
|
||||
- Conceptual and task-based information not specific to new features
|
||||
- Restructuring / rewriting
|
||||
- Doc bug fixing
|
||||
- Typos and grammar errors
|
||||
|
||||
One quirk of this project is that the `master` branch is where the live docs are
|
||||
published from, so upcoming features can't be documented there. See
|
||||
[Specific new features for a project](#specific-new-features-for-a-project)
|
||||
for how to document upcoming features. These feature branches will be periodically
|
||||
merged with `master`, so don't worry about fixing typos and documentation bugs
|
||||
there.
|
||||
|
||||
>Do you enjoy creating graphics? Good graphics are key to great documentation,
|
||||
and we especially value contributions in this area.
|
||||
|
||||
### Specific new features for a project
|
||||
|
||||
Our docs cover many projects which release at different times. **If, and only if,
|
||||
your pull request relates to a currently unreleased feature of a project, base
|
||||
your work on that project's `vnext` branch.** These branches were created by
|
||||
cloning `master` and then importing a project's `master` branch's docs into it
|
||||
(at the time of the migration), in a way that preserved the commit history. When
|
||||
a project has a release, its `vnext` branch will be merged into `master` and your
|
||||
work will be visible on [https://docs.docker.com/](https://docs.docker.com/).
|
||||
|
||||
The following `vnext` branches currently exist:
|
||||
|
||||
- **[vnext-engine](https://github.com/docker/docker.github.io/tree/vnext-engine):**
|
||||
docs for upcoming features in the [docker/docker](https://github.com/moby/moby/)
|
||||
project
|
||||
|
||||
- **[vnext-compose](https://github.com/docker/docker.github.io/tree/vnext-compose):**
|
||||
docs for upcoming features in the [docker/compose](https://github.com/docker/compose/)
|
||||
project
|
||||
|
||||
- **[vnext-distribution](https://github.com/docker/docker.github.io/tree/vnext-distribution):**
|
||||
docs for upcoming features in the [docker/distribution](https://github.com/docker/distribution/)
|
||||
project
|
||||
|
||||
- **[vnext-swarm](https://github.com/docker/docker.github.io/tree/vnext-swarm):**
|
||||
docs for upcoming features in the [docker/swarm](https://github.com/docker/swarm/)
|
||||
project
|
||||
|
||||
- **[vnext-toolbox](https://github.com/docker/docker.github.io/tree/vnext-toolbox):**
|
||||
docs for upcoming features in the [docker/toolbox](https://github.com/docker/toolbox/)
|
||||
project
|
||||
> Do you enjoy creating graphics? Good graphics are key to great documentation,
|
||||
> and we especially value contributions in this area.
|
||||
|
||||
## Per-PR staging on GitHub
|
||||
|
||||
For every PR against `master` and all the long-lived branches, a staged version
|
||||
of the site is built using Netlify. If the site builds, you will see
|
||||
**deploy/netlify — Deploy preview ready**. Otherwise, you will see an error.
|
||||
Click **Details** to review the staged site or the errors that prevented it from
|
||||
building. Review the staged site and amend your commit if necessary. Reviewers
|
||||
will also check the staged site before merging the PR, to protect the integrity
|
||||
of [https://docs.docker.com/](https://docs.docker.com/).
|
||||
For every PR against `master`, a staged version of the site is built using Netlify.
|
||||
If the site builds, you will see **deploy/netlify — Deploy preview ready**.
|
||||
Otherwise, you will see an error. Click **Details** to review the staged site or
|
||||
the errors that prevented it from building. Review the staged site and amend your
|
||||
commit if necessary. Reviewers will also check the staged site before merging the
|
||||
PR, to protect the integrity of [https://docs.docker.com/](https://docs.docker.com/).
|
||||
|
||||
## Staging the docs
|
||||
## Build the docs locally
|
||||
|
||||
You have three options:
|
||||
|
||||
|
@ -136,7 +91,7 @@ You have three options:
|
|||
```bash
|
||||
git clone --recursive https://github.com/docker/docker.github.io.git
|
||||
cd docker.github.io
|
||||
docker-compose up
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
If you haven't got Docker Compose installed,
|
||||
|
@ -152,7 +107,17 @@ You have three options:
|
|||
docker-compose down
|
||||
```
|
||||
|
||||
2. Install Jekyll and GitHub Pages on your local machine.
|
||||
2. Build and run a Docker image for your working branch.
|
||||
|
||||
```bash
|
||||
DOCKER_BUILDKIT=1 docker build -t docker build -t docker-docs
|
||||
docker run --rm -it -p 4000:4000 docker-docs
|
||||
```
|
||||
|
||||
After the `docker run` command, copy the URL provided in the container build output in a browser,
|
||||
http://0.0.0.0:4000, and verify your changes.
|
||||
|
||||
3. Install Jekyll and GitHub Pages on your local machine.
|
||||
|
||||
a. Clone this repo by running:
|
||||
|
||||
|
@ -192,16 +157,6 @@ You have three options:
|
|||
You can continue working in a second terminal and Jekyll will rebuild the
|
||||
website incrementally. Refresh the browser to preview your changes.
|
||||
|
||||
3. Build and run a Docker image for your working branch.
|
||||
|
||||
```bash
|
||||
$ docker build -t docker build -t docs/docker.github.io:<branch_name> .
|
||||
$ docker run --rm -it -p 4000:4000 docs/docker.github.io:<branch_name>
|
||||
```
|
||||
|
||||
After the `docker run` command, copy the URL provided in the container build output in a browser,
|
||||
http://0.0.0.0:4000, and verify your changes.
|
||||
|
||||
## Read these docs offline
|
||||
|
||||
To read the docs offline, you can use either a standalone container or a swarm service.
|
||||
|
@ -343,105 +298,6 @@ instance. Be sure to compress the images *before* adding them to the
|
|||
repository, doing it afterwards actually worsens the impact on the Git repo (but
|
||||
still optimizes the bandwidth during browsing).
|
||||
|
||||
## Beta content disclaimer
|
||||
```bash
|
||||
> BETA DISCLAIMER
|
||||
>
|
||||
> This is beta content. It is not yet complete and should be considered a work in progress. This content is subject to change without notice.
|
||||
```
|
||||
|
||||
## Accessing unsupported archived documentation
|
||||
|
||||
Supported documentation includes the current version plus the previous five versions.
|
||||
|
||||
If you are using a version of the documentation that is no longer supported, which means that the version number is not listed in the site dropdown list, you can still access that documentation in the following ways:
|
||||
|
||||
- By entering your version number and selecting it from the branch selection list for this repo
|
||||
- By directly accessing the Github URL for your version. For example, https://github.com/docker/docker.github.io/tree/v1.9 for `v1.9`
|
||||
- By running a container of the specific [tag for your documentation version](https://hub.docker.com/r/docs/docker.github.io/tags)
|
||||
in Docker Hub. For example, run the following to access `v1.9`:
|
||||
|
||||
```bash
|
||||
docker run -it -p 4000:4000 docs/docker.github.io:v1.9
|
||||
```
|
||||
|
||||
## Building archives and the live published docs
|
||||
|
||||
All the images described below are automatically built using Docker Hub. To
|
||||
build the site manually, from scratch, including all utility and archive images,
|
||||
see the [README in the publish-tools branch](https://github.com/docker/docker.github.io/blob/publish-tools/README.md).
|
||||
|
||||
- Some utility images are built from Dockerfiles in the `publish-tools` branch.
|
||||
See its [README](https://github.com/docker/docker.github.io/blob/publish-tools/README.md)
|
||||
for details.
|
||||
- Each archive branch automatically builds an image tagged
|
||||
`docs/docker.github.io:v<VERSION>` when a change is merged into that branch.
|
||||
- The `master` branch has a Dockerfile which uses the static HTML from each
|
||||
archive image, in combination with the Markdown
|
||||
files in `master` and some upstream resources which are fetched at build-time,
|
||||
to create the full site at [https://docs.docker.com/](/). All
|
||||
of the long-running branches, such as `vnext-engine`, `vnext-compose`, etc,
|
||||
use the same logic.
|
||||
|
||||
## Creating a new archive
|
||||
|
||||
When a new Docker Engine - Community Stable version is released, the previous state of `master`
|
||||
is archived into a version-specific branch like `v17.09`, by doing the following:
|
||||
|
||||
1. Create branch based off the commit hash before the new version was released.
|
||||
|
||||
```bash
|
||||
$ git checkout <HASH>
|
||||
$ git checkout -b v17.09
|
||||
```
|
||||
|
||||
2. Run the `_scripts/fetch-upstream-resources.sh` script. This puts static
|
||||
copies of the files in place that the `master` build typically fetches
|
||||
each build.
|
||||
|
||||
```bash
|
||||
$ _scripts/fetch-upstream/resources.sh
|
||||
```
|
||||
|
||||
3. Overwrite the `Dockerfile` with the `Dockerfile.archive` (use `cp` rather
|
||||
than `mv` so you don't inadvertently remove either file). Edit the resulting
|
||||
`Dockerfile` and set the `VER` build argument to the appropriate value, like
|
||||
`v17.09`.
|
||||
|
||||
```bash
|
||||
$ mv Dockerfile.archive Dockerfile
|
||||
$ vi Dockerfile
|
||||
|
||||
< edit the variable and save >
|
||||
```
|
||||
|
||||
4. Do `git status` and add all changes, being careful not to add anything extra
|
||||
by accident. Commit your work.
|
||||
|
||||
```bash
|
||||
$ git status
|
||||
$ git add <filename>
|
||||
$ git add <filename> (etc etc etc)
|
||||
$ git commit -m "Creating archive for 17.09 docs"
|
||||
```
|
||||
|
||||
5. Make sure the archive builds.
|
||||
|
||||
```bash
|
||||
$ docker build -t docker build -t docs/docker.github.io:v17.09 .
|
||||
$ docker run --rm -it -p 4000:4000 docs/docker.github.io:v17.09
|
||||
```
|
||||
|
||||
After the `docker run` command, browse to `http://localhost:4000/` and
|
||||
verify that the archive is self-browseable.
|
||||
|
||||
6. Push the branch to the upstream repository. Do not create a pull request
|
||||
as there is no reference branch to compare against.
|
||||
|
||||
```bash
|
||||
$ git push upstream v17.09
|
||||
```
|
||||
|
||||
## Copyright and license
|
||||
|
||||
Code and documentation copyright 2017 Docker, inc, released under the Apache 2.0 license.
|
||||
|
|
|
@ -11,8 +11,6 @@ incremental: true
|
|||
permalink: pretty
|
||||
safe: false
|
||||
lsi: false
|
||||
# This needs to have all the directories you expect to be in the archives (delivered by docs-base in the Dockerfile)
|
||||
keep_files: ["v17.06", "v18.03", "v18.09"]
|
||||
exclude: ["_scripts", "tests", "apidocs/layouts", "Gemfile", "hooks", "index.html", "404.html"]
|
||||
|
||||
# Google Analytics, etc.
|
||||
|
|
|
@ -11,8 +11,6 @@ incremental: false
|
|||
permalink: pretty
|
||||
safe: false
|
||||
lsi: false
|
||||
# This needs to have all the directories you expect to be in the archives (delivered by docs-base in the Dockerfile)
|
||||
keep_files: ["v17.06", "v18.03", "v18.09"]
|
||||
exclude: ["_scripts", "tests", "apidocs/layouts", "Gemfile", "hooks", "index.html", "404.html"]
|
||||
|
||||
# Component versions -- address like site.docker_ce_version
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{% for item in site.data.docsarchive.archives %}{% if item.current == true %}Docker {{ item.name }} (current) {% endif %} {% endfor %}<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{% for item in site.data.docsarchive.archives %}{% if item.current != true %}<li><a href="/{{ item.name }}/">Docker {{ item.name }}</a></li>{% endif %}{% endfor %}
|
||||
</ul>
|
||||
</div>
|
|
@ -109,7 +109,7 @@
|
|||
</div>
|
||||
|
||||
{% if page.path == "404.md" %}
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var path = window.location.pathname.replace("#", "");
|
||||
var ghIssueQueryString = "https://github.com/docker/docker.github.io/issues/new?" + "title=404%20at%20" + path + "&body=URL%3A%20" + path;
|
||||
document.getElementsByClassName("nomunge")[1].onclick = function () {
|
||||
|
@ -128,24 +128,11 @@
|
|||
hljs.initHighlightingOnLoad();
|
||||
</script>
|
||||
{% endif %}
|
||||
<script>var pageURL = "{{ page.url }}";</script>
|
||||
<script defer src="/js/anchorlinks.js"></script>
|
||||
<script defer src="/js/menu.js"></script>
|
||||
<script src="/js/jquery.js"></script>
|
||||
<script src="/js/bootstrap.min.js"></script>
|
||||
<!-- Always include the archive.js, but it doesn't do much unless we are an archive -->
|
||||
<script>
|
||||
// Default to assuming this is an archive and hiding some stuff
|
||||
// See js/archive.js and js/docs.js for logic relating to this
|
||||
var dockerVersion = 'v{{ site.docker_ce_version }}';
|
||||
// In archives, we need to know the page root and we get it from JEKYLL_ENV in the jekyll build command
|
||||
var jekyllEnv = '{{ jekyll.environment }}';
|
||||
// If unset (in non-archive branches), defaults to "development". In that case, reset it to empty
|
||||
if (jekyllEnv === 'development') {
|
||||
jekyllEnv = '';
|
||||
}
|
||||
var pageURL = jekyllEnv + '{{ page.url }}';
|
||||
</script>
|
||||
<script src="/js/archive.js"></script>
|
||||
<script src="/js/stickyfill.min.js"></script>
|
||||
<script defer src="/js/metadata.js"></script>
|
||||
<script src="/js/glossary.js"></script>
|
||||
|
|
|
@ -59,9 +59,4 @@
|
|||
<script type="application/ld+json">{"@context":"http://schema.org","@type":"WebPage","headline":"{{ page.title }}","description":"{{ page.description }}","url":"https://docs.docker.com{{ page.url }}"}</script>
|
||||
<!-- END SEO STUFF -->
|
||||
{% if page.hide_from_sitemap %}<meta name="robots" content="noindex" />{% endif %}
|
||||
<script>
|
||||
// Default to assuming this is an archive and hiding some stuff
|
||||
// See js/archive.js and js/docs.js for logic relating to this
|
||||
var dockerVersion = 'v{{ site.docker_ce_version }}';
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -26,8 +26,4 @@
|
|||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ctrl-right">
|
||||
<a href="javascript:void(0)" id="menu-toggle"><i class="fa fa-indent" aria-hidden="true"></i></a>
|
||||
{% include archive-list.html %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,145 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
while getopts ":hv:s:" opt; do
|
||||
case ${opt} in
|
||||
v ) version="$OPTARG"
|
||||
;;
|
||||
s ) SHA="$OPTARG"
|
||||
;;
|
||||
\? ) echo "Usage: $0 [-h] | -v <docker-version> -s <GIT-SHA-OF-ARCHIVE>"
|
||||
echo ""
|
||||
echo "<docker-version> is in the format \"17.09\" without any \"v\" prepended."
|
||||
echo "<GIT-SHA-OF-ARCHIVE> is a Git SHA which is the last commit before work started that doesn't apply to this archive."
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If we can't find a version, exit gracefully
|
||||
if [ -z "$version" ]; then
|
||||
echo "-v is a required argument and was not detected."
|
||||
exit 1
|
||||
else
|
||||
# Do some very basic and naive checks on the format
|
||||
# We expect it to start with a number
|
||||
if ! [[ $version =~ ^[1-9].*[0-9]$ ]]; then
|
||||
echo "Invalid version. Expected numbers and dots, but got $version"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If we don't have a SHA for the archive, exit
|
||||
if [ -z "$SHA" ]; then
|
||||
echo "-s is a required argument and was not detected."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Exit if we are not running from a clean master
|
||||
|
||||
BRANCH=$(git branch | grep '*' | awk {'print $2'})
|
||||
|
||||
if [ "$BRANCH" != "master" ]; then
|
||||
echo "You are on branch $BRANCH but an archive can only be created from master. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Make sure our working branch is clean
|
||||
|
||||
BRANCH_STATUS=$(git diff --cached --exit-code)
|
||||
BRANCH_STATUS_UNTRACKED=$(git ls-files --other --directory --exclude-standard | head -n 1)
|
||||
|
||||
if [ $BRANCH_STATUS -o "$BRANCH_STATUS_UNTRACKED" ]; then
|
||||
echo "Branch has uncommitted changes or untracked files. Exiting to protect you."
|
||||
echo "Use a fresh clone for this, not your normal working clone."
|
||||
echo "If you don't want to set up all your remotes again,"
|
||||
echo "recursively copy (cp -r on a mac) your docker.github.io directory to"
|
||||
echo "a new directory like archive-clone and run this script again from there."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check out the SHA
|
||||
|
||||
echo "Making archive based on $SHA"
|
||||
git pull -q
|
||||
git checkout -q ${SHA}
|
||||
status=$?
|
||||
|
||||
if [ $status -ne 0 ]; then
|
||||
echo "Failed to check out $SHA. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Create the archive branch
|
||||
|
||||
git checkout -b v"$version" && echo "Created branch v$version and checked it out."
|
||||
|
||||
# Replace the Dockerfile, set the version
|
||||
cat Dockerfile.archive |sed "s/vXX/v${version}/g" > Dockerfile
|
||||
|
||||
# Run _scripts/fetch_upstream_resources.sh once in local mode
|
||||
bash _scripts/fetch-upstream-resources.sh -l
|
||||
|
||||
# Add a redirect page for each section that doesn't apply to the archives, where
|
||||
# the reader should look in the live content instead
|
||||
# Currently, this is:
|
||||
# /samples/
|
||||
# /docker-id/
|
||||
# /docker-hub/
|
||||
# These rely on _layout/archive-redirect.html
|
||||
|
||||
only_live_contents=("samples" "docker-id" "docker-hub")
|
||||
|
||||
for dir in "${only_live_contents[@]}"; do
|
||||
echo "Replacing contents of $dir with a redirect stub"
|
||||
# Figure out the title, which should be title case with spaces instead of dashes
|
||||
dir_title=$(echo $dir | sed 's/-/\ /g' | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1')
|
||||
echo "dir_title is ${dir_title}"
|
||||
rm -Rf $dir/*
|
||||
cat << EOF > "$dir/index.html"
|
||||
---
|
||||
layout: archive-redirect
|
||||
prod_title: "$dir_title"
|
||||
prod_url: "$dir"
|
||||
---
|
||||
EOF
|
||||
|
||||
done
|
||||
|
||||
echo "You are almost done. There are FOUR manual steps left to do."
|
||||
echo "1. Edit _data/toc.yaml and remove all the entries under the following"
|
||||
echo " locations except for their roots. For instance, remove all of"
|
||||
echo " /samples/ entries except /samples/ itself."
|
||||
echo " A valid example for samples would look like:"
|
||||
|
||||
cat << EOF
|
||||
samples:
|
||||
- sectiontitle: Sample applications
|
||||
section:
|
||||
- path: /samples/
|
||||
title: Samples home
|
||||
EOF
|
||||
|
||||
echo " Do this for the following sections:"
|
||||
for dir in "${only_live_contents[@]}"; do
|
||||
echo " /$dir/"
|
||||
done
|
||||
echo
|
||||
|
||||
echo "2. Do a local build and run to test your archive."
|
||||
echo " docker build -t archivetest ."
|
||||
echo " docker run --rm -it -p 4000:4000 archivetest"
|
||||
|
||||
echo "3. After carefully reviewing the output of 'git status' to make sure no"
|
||||
echo " files are being added by mistake, Run the following to add and commit"
|
||||
echo " all your changes, including new files:"
|
||||
echo " git commit -m \"Created archive branch v$version\" -A"
|
||||
|
||||
echo "4. Push your archive to the upstream remote:"
|
||||
echo " git push upstream v$version"
|
||||
echo
|
||||
echo "99. If you want to bail out of this operation completely,"
|
||||
echo " and get back to master, run the following:"
|
||||
echo
|
||||
echo " git reset --hard; git clean -fd; git checkout master; git branch -D v$version"
|
||||
echo
|
|
@ -1,15 +0,0 @@
|
|||
#ratings-div,
|
||||
.ctrl-right .btn-group,
|
||||
.feedback-links li:first-of-type,
|
||||
.search-form {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.not-archive {
|
||||
#ratings-div,
|
||||
.ctrl-right .btn-group,
|
||||
.feedback-links li:first-of-type,
|
||||
.search-form {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@
|
|||
# Docker Documentation Theme
|
||||
---
|
||||
|
||||
@import "archive";
|
||||
@import "breakpoint";
|
||||
@import "variables";
|
||||
@import "night-mode";
|
||||
|
|
|
@ -5,48 +5,22 @@ title: View the docs archives
|
|||
This page lists the various ways you can view the docs as they were when a
|
||||
prior version of Docker was shipped.
|
||||
|
||||
**Note**: To access documentation for an unsupported version, refer to
|
||||
[Accessing unsupported archived documentation](#accessing-unsupported-archived-documentation).
|
||||
|
||||
{% for archive in site.data.docsarchive.archives %}
|
||||
|
||||
{% if archive.current %}
|
||||
|
||||
## {{ archive.name }} (current)
|
||||
|
||||
Docs for {{ archive.name }} _(current)_ are accessible at [**https://docs.docker.com/**](/), or
|
||||
to view the docs offline on your local machine, run:
|
||||
To view the docs offline on your local machine, run:
|
||||
|
||||
```
|
||||
docker run -ti -p 4000:4000 {{ archive.image }}
|
||||
```
|
||||
|
||||
{% else %}
|
||||
|
||||
{% if archive.name != 'edge' %}
|
||||
|
||||
## {{ archive.name }}
|
||||
|
||||
Docs for {{ archive.name }} are accessible at [**https://docs.docker.com/{{ archive.name }}/**](/{{ archive.name }}/), or to view the docs offline on your local machine,
|
||||
run:
|
||||
|
||||
```
|
||||
docker run -ti -p 4000:4000 {{ archive.image }}
|
||||
```
|
||||
|
||||
{% endif %} <!-- edge check -->
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
## Accessing unsupported archived documentation
|
||||
|
||||
If you are using a version of the documentation that is no longer supported, which means that the version number is not listed in the site drop-down list, you can still access that documentation in the following ways:
|
||||
If you are using a version of the documentation that is no longer supported,
|
||||
you can still access that documentation in the following ways:
|
||||
|
||||
- By entering your version number and selecting it from the branch selection list for this repo
|
||||
- By directly accessing the Github URL for your version. For example, https://github.com/docker/docker.github.io/tree/v1.9 for `v1.9`
|
||||
- By running a container of the specific [tag for your documentation version](https://hub.docker.com/r/docs/docker.github.io)
|
||||
in Docker Hub. For example, run the following to access `v1.9`:
|
||||
in Docker Hub. For example, run the following to access `v1.9`:
|
||||
|
||||
```bash
|
||||
```bash
|
||||
docker run -it -p 4000:4000 docs/docker.github.io:v1.9
|
||||
```
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
---
|
||||
layout: null
|
||||
---
|
||||
|
||||
/* Only run this if we are online*/
|
||||
if (window.navigator.onLine) {
|
||||
var suppressButterBar = false;
|
||||
/* This JSON file contains a current list of all docs versions of Docker */
|
||||
$.getJSON("/js/archives.json", function (result) {
|
||||
var outerDivStart =
|
||||
'<div id="archive-butterbar"><div class="container"><div style="text-align: center"><span id="archive-list">This is <b><a href="https://docs.docker.com/docsarchive/" style="color: #254356; text-decoration: underline !important">archived documentation</a></b> for Docker ' +
|
||||
dockerVersion +
|
||||
'. Go to the <a style="color: #254356; text-decoration: underline !important" href="https://docs.docker.com/">latest docs</a> or a different version: </span>' +
|
||||
'<span style="z-index: 1001" class="dropdown">';
|
||||
var listStart =
|
||||
'<ul class="dropdown-menu" role="menu" aria-labelledby="archive-menu">';
|
||||
var listEnd = "</ul>";
|
||||
var outerDivEnd = "</span></div></div></div>";
|
||||
var buttonCode = null;
|
||||
var listItems = new Array();
|
||||
$.each(result, function (i, field) {
|
||||
if (field.name == dockerVersion && field.current) {
|
||||
// We are the current version so we don't need a butterbar
|
||||
suppressButterBar = true;
|
||||
} else {
|
||||
var prettyName = "Docker " + field.name.replace("v", "");
|
||||
// If this archive has current = true, and we don't already have a button
|
||||
if (field.current && buttonCode == null) {
|
||||
// Get the button code
|
||||
buttonCode =
|
||||
'<button id="archive-menu" data-toggle="dropdown" class="btn dropdown-toggle" style="border: 1px solid #254356; background-color: #fff; color: #254356;">' +
|
||||
prettyName +
|
||||
' (current) <span class="caret"></span></button>';
|
||||
// The link is different for the current release
|
||||
listItems.push(
|
||||
'<li role="presentation"><a role="menuitem" tabindex="-1" href="https://docs.docker.com/">' +
|
||||
prettyName +
|
||||
"</a></li>"
|
||||
);
|
||||
} else {
|
||||
listItems.push(
|
||||
'<li role="presentation"><a role="menuitem" tabindex="-1" href="https://docs.docker.com/' +
|
||||
field.name +
|
||||
'/">' +
|
||||
prettyName +
|
||||
"</a></li>"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// only append the butterbar if we are NOT the current version
|
||||
// Also set the isArchive variable to true if it's an archive. It defaults
|
||||
// to true, set in _layouts/docs.html. We default to true because it looks
|
||||
// better in CSS to show stuff than to hide stuff onLoad.
|
||||
if (suppressButterBar == false) {
|
||||
$("body").prepend(
|
||||
outerDivStart +
|
||||
buttonCode +
|
||||
listStart +
|
||||
listItems.join("") +
|
||||
listEnd +
|
||||
outerDivEnd
|
||||
);
|
||||
$("body").addClass("archive");
|
||||
// If the butterbar exists, deal with positioning it
|
||||
// Depends on some logic in _layout/docs.html
|
||||
$(document).scroll(function () {
|
||||
if ($("nav").hasClass("affix")) {
|
||||
$("#archive-butterbar").addClass("fixed").removeClass("top");
|
||||
} else {
|
||||
$("#archive-butterbar").addClass("top").removeClass("fixed");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("body").addClass("not-archive");
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
layout: null
|
||||
---
|
||||
{{ site.data.docsarchive.archives | jsonify }}
|
Loading…
Reference in New Issue