Skip to content

Commit 169d379

Browse files
authored
Merge pull request #485 from butler54/container-mount-darwin
fix: support make serve on mac os
2 parents 09d1498 + 182a1ec commit 169d379

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
HOMEPAGE_CONTAINER ?= quay.io/hybridcloudpatterns/homepage-container:latest
2+
UNAME=$(shell uname -s)
23

3-
PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host
4-
4+
# Can't use host networks on MacOS as it's a VM anyway.
5+
# Also because of the proxy 127.0.0.1 doesn't work as a bind address.
6+
ifeq ($(UNAME), Darwin)
7+
PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer -p 4000:4000
8+
HUGO_SERVER_OPTS = --bind 0.0.0.0
9+
else
10+
PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host
11+
endif
512
# Do not use selinux labeling when we are using nfs
613
FSTYPE=$(shell df -Th . | grep -v Type | awk '{ print $$2 }')
14+
715
ifeq ($(FSTYPE), nfs)
816
ATTRS = "rw"
917
else ifeq ($(FSTYPE), nfs4)
1018
ATTRS = "rw"
19+
else ifeq ($(UNAME), Darwin)
20+
ATTRS = "rw"
1121
else
1222
ATTRS = "rw,z"
1323
endif
@@ -30,7 +40,7 @@ build: ## Build the website locally in the public/ folder
3040
.PHONY: serve
3141
serve: ## Build the website locally from a container and serve it
3242
@echo "Serving via container. Browse to http://localhost:4000"
33-
podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER) server -p 4000
43+
podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER) server -p 4000 $(HUGO_SERVER_OPTS)
3444

3545
.PHONY: htmltest
3646
htmltest: build ## Runs htmltest against the site to find broken links

0 commit comments

Comments
 (0)