#! /usr/bin/env -S nix develop . --command just --justfile fly-system := "x86_64-linux" fly-registry := "registry.fly.io/alanpearce-eu" docker-tag := env_var_or_default("DOCKER_TAG", `git rev-parse HEAD`) default: @just --list --justfile {{ justfile() }} --unsorted check: nix flake check . --print-build-logs check-licenses: nix run nixpkgs#go-licenses update-all: go get -u all gomod2nix --outdir nix nix flake update watch-flake command: watchexec --restart -w flake.nix -w flake.lock direnv exec . {{ command }} watch-builder: (watch-flake "watchexec -i cmd/server -i public -r go run ./cmd/build --base-url http://localhost:3000") nix-build what: nix build .#{{ what }} watch-server: (watch-flake "watchexec -r go run ./cmd/server") docker-stream system=(arch() + "-linux"): @nix build --print-out-paths .#docker-stream-{{ system }} | sh docker-image system=(arch() + "-linux"): nix build .#docker-image-{{ system }} docker-stream-fly: just docker-stream {{ fly-system }} docker-image-fly: (docker-image fly-system) docker-inspect image-path="result" *skopeo-flags="": skopeo {{ skopeo-flags }} inspect docker-archive:{{ image-path }} print-docker-tag: @echo {{ docker-tag }} stream-to-registry *skopeo-flags="": just docker-stream-fly | gzip --fast | skopeo {{ skopeo-flags }} copy --dest-precompute-digests docker-archive:/dev/stdin docker://{{ fly-registry }}:{{ docker-tag }} result := `readlink -f result` push-to-registry *skopeo-flags="": skopeo {{ skopeo-flags }} copy --dest-precompute-digests docker-archive://{{ result }} docker://{{ fly-registry }}:{{ docker-tag }} deploy registry-and-tag=(fly-registry + ":" + docker-tag): fly deploy --image {{ registry-and-tag }}