Containerfile, Justfile targets for container building and control, as well as version information

This commit is contained in:
Imbus 2024-10-21 07:03:51 +02:00
parent 3e6eefced0
commit fe9e271a97
2 changed files with 88 additions and 1 deletions

View file

@ -1,3 +1,5 @@
# Written and tested 2024-10-21 with just 1.34.0 on Fedora 41
# See: https://github.com/bigskysoftware/htmx/releases
# For static latest: https://github.com/bigskysoftware/htmx/releases/latest/download/htmx.min.js
htmx-ver := "2.0.3"
@ -21,7 +23,31 @@ get-htmx:
[doc("Cleanup source tree")]
[confirm("Are you sure? [y/N]:")]
clean:
clean: clean-container
rm -rf .go
rm -rf build
rm -f htmx.min.js
# Build the container
build-container: get-htmx
podman build -t htmx-demo -f container/Containerfile .
# Spin up a production container
run-container:
# Build the image if it doesnt exist
podman image exists htmx-demo || just build-container
# Stop existing if its running
podman container exists htmx-demo-container && podman stop htmx-demo-container || true
# Run the container
podman run -d --rm --name htmx-demo-container -p 8085:8080 htmx-demo
@echo "Server running on http://localhost:8085"
# Remove containers, images and dependencies for container build
clean-container:
podman container exists htmx-demo-container && podman stop htmx-demo-container || true
podman image exists htmx-demo && podman rmi htmx-demo || true
podman image exists golang && podman rmi golang || true
podman image exists alpine && podman rmi alpine || true
podman builder prune -f