Some contents of this chapter have been copied from the Using Slate in Docker documentation on the Slate Wiki.
This guide assumes you are using a Docker-supported Linux-capable system. You could for instance be running Ubuntu in the Windows Terminal using Windows Subsystem for Linux (WSL). In that case you'd be using the dropdown menu in the tab bar to change to your Ubuntu terminal profile.
Docker: See this page for installing Docker Desktop.
Slate:
- Go to the directory where you wish to store slate and the documentation files. E.g.
cd /mnt/e/
. - Clone the Slate repository to your hard drive with
git clone https://github.com/slatedocs/slate.git
.- You can also use
git clone https://github.com/Remi-Lo/slate.git
but it might be out of sync when pulling. - If you intend to create a custom version of Slate:
- Fork the slatedocs repository on GitHub before cloning.
- Use
git clone https://github.com/YOURGITHUBUSERNAME/slate.git
when cloning to your hard-drive.
- You can also use
- Go to the slate directory (
cd slate
). - Grab the slate image (
docker pull slatedocs/slate
) or build the docker image for the repository (docker build . -t slatedocs/slate
). - Go to the parent directory (
cd ..
).
Note: If you are using the pre-built images for Slate, you may wish to remove all files other than the source
directory from your repository.
- Go to where the slate directory is stored (eg.
cd /mnt/e/
). - Visit the api_docs repository on the Timegrip Bitbucket
- Click Clone and copy the git clone command.
- Run the command in the terminal:
- E.g.
git clone https://YOURBITBUCKETUSERNAME@bitbucket.org/timegrip/api_docs.git
.
- E.g.
To use Docker to build your site, run the following command but modify cd /mnt/e/
to be where the slate directory is stored first (eg. /mnt/c/containers/
):
cd /mnt/e/ & docker run --rm --name slate -v $(pwd)/slate/build:/srv/slate/build -v $(pwd)/api_docs/source:/srv/slate/source slatedocs/slate build
After this command completes, you should see the built artifacts for your site in the $(pwd)/build
directory, which you can then statically serve for your website.
Note: You may omit the final build
argument and get the same result. By default, if given no command, the Dockerfile will run build
.
If you wish to run the development server for Slate to aid in working on the site, run:
docker run --rm --name slate -p 4567:4567 -v $(pwd)/api_docs/source:/srv/slate/source slatedocs/slate serve
and you will be able to access your site at http://localhost:4567 until you stop the running container process.
See the official Slate repository for: