Skip to content

Commit 46cdf00

Browse files
committed
Add support for container to run site
1 parent 2436b5c commit 46cdf00

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Makefile for managing the Swift website with the container app
2+
3+
.PHONY: help build run-build website stop clean
4+
5+
help:
6+
@echo "Usage:"
7+
@echo " make build Build the swift-website-builder container image"
8+
@echo " make run-build Build the Jekyll website"
9+
@echo " make website Run the Jekyll development server"
10+
@echo " make stop Stop the running website container"
11+
@echo " make clean Stop the container and remove the build output"
12+
13+
# Build the primary container image
14+
build:
15+
container build --tag swift-website-builder --file Dockerfile .
16+
17+
# Run a one-off Jekyll build
18+
run-build:
19+
@mkdir -p ./.output
20+
container run --rm \
21+
-v "$(CURDIR)":/srv/jekyll \
22+
-v "$(CURDIR)/.output":/output \
23+
swift-website-builder \
24+
/bin/bash -cl "bundle check && bundle exec jekyll build --source /srv/jekyll --destination /output"
25+
26+
# Run the development web server
27+
website:
28+
@mkdir -p ./.output
29+
container run -d --rm --name swift-website \
30+
-p 4000:4000 \
31+
-v "$(CURDIR)":/srv/jekyll \
32+
-v "$(CURDIR)/.output":/output \
33+
swift-website-builder \
34+
/bin/bash -cl "bundle check && bundle exec jekyll serve --source /srv/jekyll --destination /output --host 0.0.0.0 --watch"
35+
@echo "Website is running at http://localhost:4000"
36+
37+
# Stop the development server
38+
stop:
39+
container stop swift-website
40+
41+
# Clean up build artifacts
42+
clean: stop
43+
@echo "Removing .output directory..."
44+
@rm -rf ./.output

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ npm install
4848
npm run prettify
4949
```
5050

51+
### Running with Apple Container
52+
53+
On macOS 26 and later, you can use the [Apple Container](https://github.com/apple/container) tool to host and run the website.
54+
55+
First install and run `container`:
56+
57+
```shell
58+
brew install container
59+
brew services start container
60+
```
61+
62+
Then build and run the site:
63+
64+
```shell
65+
make build
66+
make website
67+
```
68+
69+
The website will be available at `http://localhost:4000`
70+
5171
### Running in Docker
5272

5373
First build the site with Docker Compose:

0 commit comments

Comments
 (0)