Skip to content

feat: dockerize #2379

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

Closed
wants to merge 2 commits into from
Closed
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 .`
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
18 changes: 18 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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

# The following CMD is run every time the Container starts
CMD ["bash", "run.sh"]
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:
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
5 changes: 5 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd docs && make dockerhtml &

wait