Skip to content

Commit ffb7038

Browse files
feat: dockerize with requested changes (#2392)
1 parent 62b24a3 commit ffb7038

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ If you have verified this command on Windows, we invite you to submit a PR to in
108108

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

111+
### Using Docker
112+
113+
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.
114+
115+
1. Make sure Docker Desktop is running and started
116+
1. Build the Docker Image from the root directory with the command: `docker build -t wtd .`
117+
2. Run the Docker Image Container using that Image ID: `docker run -p 8888:8888 wtd`
118+
3. Access the live site on <http://localhost:8888> through your web browser
119+
4. Both the Docker Container and Image will be present in Docker Desktop
120+
111121
### Requirements
112122

113123
Make sure all of the following is installed.

dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM python:3.9.22
2+
3+
RUN mkdir /www
4+
WORKDIR /www
5+
COPY . .
6+
7+
# Update the Linux environment/Operating System
8+
RUN apt-get update
9+
RUN apt-get autoremove -y
10+
RUN apt-get autoclean -y
11+
RUN apt-get upgrade -y
12+
13+
# Download the Python3 dependencies
14+
RUN python3 -m pip install --upgrade pip
15+
RUN python3 -m pip install -r requirements.txt
16+
17+
WORKDIR /www/docs
18+
19+
RUN chmod +x make.bat
20+
21+
# The following CMD is run every time the Container starts
22+
CMD ["make", "dockerhtml"]

docs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ html:
5959
livehtml:
6060
sphinx-autobuild --port 8888 -j auto --watch _data -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/html
6161

62+
# Used solely to bind sphinx to the Docker Container - to do so requires deliberately setting --host "0.0.0.0"
63+
dockerhtml:
64+
sphinx-autobuild --port 8888 --host "0.0.0.0" -j auto --watch _data -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/html
65+
6266
oldhtml:
6367
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
6468
@echo

docs/make.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ if "%1" == "help" (
1818
echo.Please use `make ^<target^>` where ^<target^> is one of
1919
echo. html to make standalone HTML files
2020
echo. livehtml to make live HTML files to view the docs on a local web server
21+
echo. dockerhtml to make live HTML files and view through a local docker container
2122
echo. dirhtml to make HTML files named index.html in directories
2223
echo. singlehtml to make a single large HTML file
2324
echo. pickle to make pickle files
@@ -52,6 +53,11 @@ if "%1" == "livehtml" (
5253
sphinx-autobuild -p 8888 -z _data -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/html
5354
)
5455

56+
REM Used solely to bind sphinx to the Docker Container - to do so requires deliberately setting --host "0.0.0.0"
57+
if "%1" == "dockerhtml" (
58+
sphinx-autobuild -p 8888 -h "0.0.0.0" -z _data -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/html
59+
)
60+
5561
if "%1" == "dirhtml" (
5662
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
5763
echo.

0 commit comments

Comments
 (0)