Skip to content

Commit be50144

Browse files
committed
Updated README.md to add Docker instructions
1 parent c1dd36e commit be50144

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,45 @@ To test the site in a local server:
104104

105105
python generator.py test
106106

107+
### Building with Docker
108+
Using Docker, you can have a complete, consistent development environment without having to manually install dependencies and set up your environment. It also helps isolate these dependencies and their data from other projects that you may have on the same computer that use different/conflicting versions, etc.
109+
110+
Note that this takes up a significant amount of space on your machine. Make sure you have at least 5GB free.
111+
112+
#### Included files
113+
114+
Two files are included that are used by Docker to configure the environment, build, and serve the site. These files are pre-configured, and you typically won't need to edit them:
115+
116+
* The `Dockerfile` contains instructions to set up the development environment.
117+
118+
* The `docker-compose.yml` file defines three services to manage the application lifecycle:
119+
* `app`: A base service that keeps the container running indefinitely. It's useful for debugging or running arbitrary commands within the container.
120+
* `build`: A service that runs the generator.py script to build the static site.
121+
* `serve`: A service that serves the generated site using Python's built-in HTTP server.
122+
123+
#### Step 1: Setting up
124+
1.Install Docker for your operating system
125+
* [Mac](https://www.docker.com/docker-mac)
126+
* [Windows](https://www.docker.com/docker-windows)
127+
2. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/)
128+
3. Clone this repository and `cd` into it
129+
4. Build the Docker Image: `docker build -t processing-py-site .` This command creates a Docker image named processing-py-site, based on the instructions in the `Dockerfile` present in the repository.
130+
131+
#### Step 2: Building the static site
132+
133+
To build the static site using Docker Compose, run the following command from the root of your project:
134+
135+
`docker-compose run --rm build`
136+
137+
This command starts a Docker container using the configuration from the `build` service, which executes the `generator.py` script to generate the static site. The `--rm` flag ensures the container is removed after the script finishes.
138+
139+
#### Step 3: Serving the Site Locally
140+
After building the site, you can serve it locally by running:
141+
142+
`docker-compose up serve`
143+
144+
This command starts a Docker container that serves the generated static site on port 8080, as specified in the `serve` service. You can view the site by navigating to `http://localhost:8080` in a web browser.
145+
107146
## Troubleshooting
108147

109148
Here are a few common and/or possible scenarios you might run into...

0 commit comments

Comments
 (0)