Skip to content

Commit b436c07

Browse files
[documentation / submitty.org] Containerize documentation site
1 parent dc8573f commit b436c07

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_site/
2+
.sass-cache/
3+
.jekyll-metadata
4+
.git/
5+
.idea/
6+
*.iml
7+
.DS_Store
8+
vendor/

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
FROM ruby:3.2-slim
3+
4+
# Install build dependencies required by native gem extensions (e.g., nokogiri)
5+
# and libcurl for htmlproofer link checking
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends \
8+
build-essential \
9+
git \
10+
libcurl4-openssl-dev \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
WORKDIR /site
14+
15+
# Install gems first (layer caching - only re-runs when Gemfile changes)
16+
COPY Gemfile Gemfile.lock ./
17+
RUN bundle install
18+
19+
# Copy the rest of the site
20+
COPY . .
21+
22+
EXPOSE 4000
23+
24+
# Serve the site, binding to 0.0.0.0 so it's accessible outside the container
25+
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--livereload"]
26+

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,40 @@ For Bundler, depending on your system, you may need to also install the
2020
Ruby development headers (e.g. `ruby-dev`). On Ubuntu/Debian,
2121
for example, this would be accomplished by doing `sudo apt-get install ruby-dev`.
2222

23+
24+
### Docker Setup (Recommended)
25+
26+
If you have [Docker](https://www.docker.com/) installed, you can skip
27+
the Ruby/Bundler prerequisites entirely:
28+
29+
1. Clone the repository:
30+
```bash
31+
git clone https://github.com/Submitty/submitty.github.io.git
32+
cd submitty.github.io
33+
```
34+
2. Start the development server:
35+
```bash
36+
docker compose up
37+
```
38+
The first run takes a few minutes to install dependencies. Subsequent
39+
runs start in seconds.
40+
41+
3. Visit [http://localhost:4000](http://localhost:4000) to view the site.
42+
Changes to files will automatically trigger a rebuild and refresh your
43+
browser.
44+
45+
4. To stop the server, press `Ctrl+C` or run:
46+
```bash
47+
docker compose down
48+
```
49+
To run the link checker with Docker:
50+
```bash
51+
docker compose exec docs bundle exec jekyll build
52+
docker compose exec docs bundle exec htmlproofer ./_site --assume-extension --empty-alt-ignore --disable_external
53+
```
54+
If you prefer to set up Ruby natively, see the manual instructions below.
55+
56+
2357
### Setup
2458

2559
1. Clone the respository on your local machine, e.g.,

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
docs:
3+
build: .
4+
ports:
5+
- "4000:4000"
6+
- "35729:35729"
7+
volumes:
8+
- .:/site
9+
- bundle_cache:/usr/local/bundle
10+
environment:
11+
- JEKYLL_ENV=development
12+
command: bundle exec jekyll serve --host 0.0.0.0 --livereload --force_polling
13+
14+
volumes:
15+
bundle_cache:

0 commit comments

Comments
 (0)