From df172df2f32aed8c0678b605045519160c8a5b18 Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Mon, 7 Oct 2024 09:50:38 +1100 Subject: [PATCH 1/3] fix: Support make serve on mac os Signed-off-by: Chris Butler --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b077dd838..87ea0179e 100644 --- a/Makefile +++ b/Makefile @@ -4,14 +4,16 @@ PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host # Do not use selinux labeling when we are using nfs FSTYPE=$(shell df -Th . | grep -v Type | awk '{ print $$2 }') +UNAME=$(shell uname -s) ifeq ($(FSTYPE), nfs) ATTRS = "rw" else ifeq ($(FSTYPE), nfs4) ATTRS = "rw" +else ifeq ($(UNAME), Darwin) + ATTRS = "rw" else ATTRS = "rw,z" endif - ##@ Docs tasks .PHONY: help From 9bf702d9e46207e81a32f99a9456bf83941e0986 Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Mon, 7 Oct 2024 14:26:47 +1100 Subject: [PATCH 2/3] fix: correct port passthrough on a mac Signed-off-by: Chris Butler --- Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 87ea0179e..37243ccce 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,18 @@ HOMEPAGE_CONTAINER ?= quay.io/hybridcloudpatterns/homepage-container:latest +UNAME=$(shell uname -s) -PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host - +# Can't use host networks on MacOS as it's a VM anyway. +# Also because of the proxy 127.0.0.1 doesn't work as a bind address. +ifeq ($(UNAME), Darwin) + PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer -p 4000:4000 + HUGO_SERVER_OPTS = "--bind 0.0.0.0" +else + PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host + HUGO_SERVER_OPTS = "" +endif # Do not use selinux labeling when we are using nfs FSTYPE=$(shell df -Th . | grep -v Type | awk '{ print $$2 }') -UNAME=$(shell uname -s) + ifeq ($(FSTYPE), nfs) ATTRS = "rw" else ifeq ($(FSTYPE), nfs4) @@ -14,6 +22,7 @@ else ifeq ($(UNAME), Darwin) else ATTRS = "rw,z" endif + ##@ Docs tasks .PHONY: help @@ -32,7 +41,7 @@ build: ## Build the website locally in the public/ folder .PHONY: serve serve: ## Build the website locally from a container and serve it @echo "Serving via container. Browse to http://localhost:4000" - podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER) server -p 4000 + podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER) server -p 4000 $(HUGO_SERVER_OPTS) .PHONY: htmltest htmltest: build ## Runs htmltest against the site to find broken links From 182a1eca0e6ec04eefcce679fad7842db966f138 Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Mon, 7 Oct 2024 14:52:44 +1100 Subject: [PATCH 3/3] fix: cleanup Signed-off-by: Chris Butler --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 37243ccce..8393bb3fd 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,9 @@ UNAME=$(shell uname -s) # Also because of the proxy 127.0.0.1 doesn't work as a bind address. ifeq ($(UNAME), Darwin) PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer -p 4000:4000 - HUGO_SERVER_OPTS = "--bind 0.0.0.0" + HUGO_SERVER_OPTS = --bind 0.0.0.0 else PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host - HUGO_SERVER_OPTS = "" endif # Do not use selinux labeling when we are using nfs FSTYPE=$(shell df -Th . | grep -v Type | awk '{ print $$2 }')