Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ If you have verified this command on Windows, we invite you to submit a PR to in

In addition to local development with Python `venv`, it is also possible to use the devcontainer found in the root of the project.

### Using Docker

A barebones [dockerfile](./dockerfile) is supplied to run the site within a local Docker Container through [Docker Desktop](https://docs.docker.com/desktop/) - a simple, free, way to easily setup Docker and Python without leaving beyond installations, modifying your underlying Operating System, and changing Environment Variables.

1. Make sure Docker Desktop is running and started
1. Build the Docker Image from the root directory with the command: `docker build -t wtd .`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plaindocs - I tweaked the recommended build per your prior comment here: #2379 (comment) - loved that suggestion - thanks!

2. Run the Docker Image Container using that Image ID: `docker run -p 8888:8888 wtd`
3. Access the live site on <http://localhost:8888> through your web browser
4. Both the Docker Container and Image will be present in Docker Desktop

### Requirements

Make sure all of the following is installed.
Expand Down
22 changes: 22 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.9.22

RUN mkdir /www
WORKDIR /www
COPY . .

# Update the Linux environment/Operating System
RUN apt-get update
RUN apt-get autoremove -y
RUN apt-get autoclean -y
RUN apt-get upgrade -y

# Download the Python3 dependencies
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install -r requirements.txt

WORKDIR /www/docs

RUN chmod +x make.bat

# The following CMD is run every time the Container starts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually took a bit - thought I could simply copy over my prior BASH script but it seems I need to/should reset the WORKDIR to use CMD (over ENTRYPOINT) for a slightly more succinct command.

CMD ["make", "dockerhtml"]
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ html:
livehtml:
sphinx-autobuild --port 8888 -j auto --watch _data -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/html

# Used solely to bind sphinx to the Docker Container - to do so requires deliberately setting --host "0.0.0.0"
dockerhtml:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments per request.

sphinx-autobuild --port 8888 --host "0.0.0.0" -j auto --watch _data -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/html

oldhtml:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
Expand Down
6 changes: 6 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if "%1" == "help" (
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. livehtml to make live HTML files to view the docs on a local web server
echo. dockerhtml to make live HTML files and view through a local docker container
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
Expand Down Expand Up @@ -52,6 +53,11 @@ if "%1" == "livehtml" (
sphinx-autobuild -p 8888 -z _data -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/html
)

REM Used solely to bind sphinx to the Docker Container - to do so requires deliberately setting --host "0.0.0.0"
if "%1" == "dockerhtml" (
sphinx-autobuild -p 8888 -h "0.0.0.0" -z _data -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/html
)

if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
echo.
Expand Down