Skip to content

Commit aa45ecf

Browse files
Add Docker image for our docs site (#594) (#597)
* Add Dockerfile, make docker-image action, and update readme * Remove stray text * Minor comment update * Split make action into docker-build and docker-serve Co-authored-by: Nik Richers <nik@validmind.ai> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent df6dad8 commit aa45ecf

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Dockerfile to build the validmind-docs image
2+
3+
# Use the official Nginx image
4+
FROM nginx:alpine
5+
6+
# Copy the static site content to the Nginx HTML directory
7+
COPY site/_site /usr/share/nginx/html
8+
9+
# Expose port 4444
10+
EXPOSE 4444
11+
12+
# Nginx starts automatically as the default CMD

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,33 @@ After you pull in the changes, commit them to this repo as part of the release n
136136
<!-- September 16, 2024: Need to mention rendered Python `.html` docs and generated `.md` test descriptions -->
137137

138138
<!-- Testing conditional changes on site/notebooks/ -->
139+
140+
## Build and serve the site with Docker
141+
142+
You can build and serve the static HTML docs site using Docker — for deployment as part of our product or for testing in a consistent local environment.
143+
144+
### Prerequisites
145+
146+
- [Docker](https://docs.docker.com/get-docker/)
147+
148+
### Build the site
149+
150+
```bash
151+
cd site
152+
make docker-build
153+
```
154+
155+
This command:
156+
157+
1. Gets all the source files.
158+
2. Renders the static site in `site/_site`.
159+
3. Builds a Docker image using the `Dockerfile`.
160+
161+
### Serve the site
162+
163+
```bash
164+
cd site
165+
make docker-serve
166+
```
167+
168+
Access the site locally: http://localhost:4444

site/Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PROFILE := exe-demo
88
FILE_PATH := notebooks/tutorials/intro_for_model_developers_EXECUTED.ipynb
99

1010
# Define .PHONY target for help section
11-
.PHONY: help clean clone notebooks python-docs docs-site deploy-demo deploy-demo-branch delete-demo-branch deploy-prod deploy-staging release-notes execute
11+
.PHONY: help clean clone notebooks python-docs docs-site deploy-demo deploy-demo-branch delete-demo-branch deploy-prod deploy-staging release-notes execute docker-build docker-serve
1212

1313
# Help section
1414
help:
@@ -27,6 +27,8 @@ help:
2727
@echo " help Display this help message (default target)"
2828
@echo " release-notes Generate release notes from pull requests since latest tag and update _quarto.yml"
2929
@echo " execute Execute a Jupyter Notebook (must have valid .env credentials set up in root)"
30+
@echo " docker-build Builds a Docker image of the docs site"
31+
@echo " docker-serve Serves the docs site at http://localhost:4444/"
3032

3133
# Clean up source directory
3234
clean:
@@ -82,8 +84,9 @@ test-descriptions:
8284
get-source: clean clone notebooks python-docs test-descriptions
8385

8486
# Get all source files
85-
docs-site: clean clone notebooks python-docs test-descriptions
86-
quarto render --profile development
87+
docs-site: get-source
88+
@echo "\nRendering the static HTML site ..."
89+
quarto render --profile production
8790

8891
# Deployment to https://docs-demo.vm.validmind.ai/
8992
deploy-demo:
@@ -131,3 +134,11 @@ release-notes:
131134
# To override: make execute PROFILE=select-profile FILE_PATH=notebooks/notebook-path-here.ipynb
132135
execute:
133136
quarto render --profile $(PROFILE) $(FILE_PATH)
137+
138+
docker-build: docs-site
139+
@echo "\nBuilding the Docker image ..."
140+
@docker build -f ../Dockerfile -t validmind-docs ..
141+
142+
docker-serve:
143+
@echo "\nStarting the Docker container on http://localhost:4444/ ..."
144+
@docker run -p 4444:80 validmind-docs

0 commit comments

Comments
 (0)