- Makefile: podman build/push from the committed tree (git archive HEAD), tagged :<commit> + :latest; PLATFORM defaults to linux/arm64 for emily. - deploy.sh: push the commit first, refuse a dirty tracked tree or HEAD != origin/main, then build and deploy that exact commit via -e image_tag (rollback = an older commit). - ansible: target emily with no become. The register role writes hops.network (NetworkName=hops_net) plus the caddy.container.d drop-in; the hops role installs ~/podman-data/hops and hops.container under systemctl --user with a podman healthcheck gate; the caddy role appends the site blocks to the shared Caddyfile and reloads. - Drop the Docker-era network role, community.docker requirements, ansible/files templates and docker-compose.yml. - .containerignore replaces .dockerignore. - README: Podman build, rootless Quadlet deploy on emily.
43 lines
1.6 KiB
Makefile
43 lines
1.6 KiB
Makefile
# Hops n Grains — container image builds.
|
|
#
|
|
# Built with Podman/Buildah, not Docker, from the committed tree
|
|
# (`git archive HEAD`) and tagged with that commit, so a deploy ships exactly
|
|
# what git knows about. deploy.sh pushes first and refuses a dirty tree.
|
|
|
|
COMMIT ?= $(shell git rev-parse --short HEAD)
|
|
|
|
# The deploy host (emily) is aarch64, so that is the default target: the image
|
|
# is built for the machine it runs on, not the one running make. Podman carries
|
|
# no built-in QEMU (unlike docker buildx), so a foreign platform needs binfmt
|
|
# handlers on this host — qemu-user-binfmt is installed here. Override with e.g.
|
|
# `make build-production PLATFORM=linux/amd64`.
|
|
PLATFORM ?= linux/arm64
|
|
|
|
IMAGE ?= registry.tanshu.com/hops
|
|
|
|
.PHONY: build-production
|
|
build-production: ## Build HEAD with podman, tag :$(COMMIT) + :latest, and push
|
|
@echo "==> podman build --platform $(PLATFORM) → $(IMAGE):$(COMMIT) + :latest"
|
|
@git archive --format=tar HEAD | podman build \
|
|
--platform $(PLATFORM) \
|
|
--tag $(IMAGE):$(COMMIT) \
|
|
--tag $(IMAGE):latest \
|
|
--pull=always \
|
|
- || { \
|
|
echo "✗ podman build failed."; \
|
|
echo " Cross-platform builds need binfmt on this host (podman has no built-in QEMU):"; \
|
|
echo " sudo apt install qemu-user-binfmt # or qemu-user-static"; \
|
|
exit 1; \
|
|
}
|
|
podman push $(IMAGE):$(COMMIT)
|
|
podman push $(IMAGE):latest
|
|
|
|
.PHONY: build-check
|
|
build-check: ## Compile check from HEAD with podman, nothing pushed
|
|
@echo "==> podman build --platform $(PLATFORM) (no push)"
|
|
git archive --format=tar HEAD | podman build \
|
|
--platform $(PLATFORM) \
|
|
--tag localhost/hops:check \
|
|
--pull=always \
|
|
-
|