2024-02-01 12:50:12 +00:00
|
|
|
# flexible use with docker and podman
|
|
|
|
platform ?= docker
|
2024-04-28 13:42:12 +00:00
|
|
|
container_workdir = /home/builder/workdir/
|
2024-12-19 20:40:29 +00:00
|
|
|
# useful option: "--userns=keep-id"
|
|
|
|
# platform_extra_options
|
|
|
|
|
2024-02-01 12:50:12 +00:00
|
|
|
|
2023-08-08 21:11:00 +00:00
|
|
|
.PHONY: build
|
|
|
|
build:
|
|
|
|
# Build Docker image
|
2024-02-01 12:50:12 +00:00
|
|
|
$(platform) build -t milksad-website .
|
2023-08-08 21:11:00 +00:00
|
|
|
|
|
|
|
.PHONY: fullclean
|
|
|
|
fullclean: clean
|
2024-02-01 12:50:12 +00:00
|
|
|
$(platform) rmi milksad-website-builder -f
|
|
|
|
$(platform) image prune --filter label=stage=milksad-website-builder
|
2023-08-08 21:11:00 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2024-04-28 13:42:12 +00:00
|
|
|
rm -rf site_export
|
2024-02-01 12:50:12 +00:00
|
|
|
|
|
|
|
site_export: build
|
|
|
|
rm -rf site_export
|
|
|
|
mkdir -p site_export
|
2024-04-28 13:42:12 +00:00
|
|
|
$(platform) run milksad-website tar c -C ${container_workdir}/_site . | tar x -C site_export
|
2023-08-08 21:11:00 +00:00
|
|
|
|
2024-02-01 12:50:12 +00:00
|
|
|
#.PHONY: serve
|
|
|
|
#serve: build
|
|
|
|
# # Run Docker container with listener for current dir and port mapping
|
|
|
|
# $(platform) run --rm -p 0.0.0.0:4000:80 -it milksad-website
|
2023-08-08 21:11:00 +00:00
|
|
|
|
2024-02-01 12:50:12 +00:00
|
|
|
upload: site_export
|
|
|
|
rsync -av --delete site_export/ milksad-website:/var/www/html
|
2023-08-08 21:11:00 +00:00
|
|
|
|
|
|
|
.PHONY: build-dev
|
|
|
|
build-dev:
|
|
|
|
# Build Docker image
|
2024-02-01 12:50:12 +00:00
|
|
|
$(platform) build --target builder -t dev-milksad-website .
|
2023-08-08 21:11:00 +00:00
|
|
|
|
|
|
|
.PHONY: dev
|
|
|
|
dev: build-dev
|
2024-12-19 20:40:29 +00:00
|
|
|
$(platform) run --rm --expose 4000 -p 127.0.0.1:4000:4000 --mount type=bind,source=${PWD},target=${container_workdir} $(platform_extra_options) -it dev-milksad-website jekyll serve -H 0.0.0.0
|
2024-02-01 12:50:12 +00:00
|
|
|
|
|
|
|
.PHONY: dev-shell
|
|
|
|
dev-shell: build-dev
|
2024-12-19 20:40:29 +00:00
|
|
|
$(platform) run --rm --expose 4000 -p 127.0.0.1:4000:4000 --mount type=bind,source=${PWD},target=${container_workdir} $(platform_extra_options) -it dev-milksad-website sh
|