2024-04-21 13:52:40 +00:00
|
|
|
ENVRUN_VERSION := 0.7.1
|
|
|
|
PACKER_VERSION := 1.10.2
|
|
|
|
YQ_VERSION := 4.31.2
|
2022-12-17 00:05:27 +00:00
|
|
|
|
2024-04-21 13:52:40 +00:00
|
|
|
ENVRUN := ./envrun_$(ENVRUN_VERSION)
|
|
|
|
PACKER := ./packer_$(PACKER_VERSION)
|
|
|
|
YQ := ./yq_$(YQ_VERSION)
|
2022-12-17 00:05:27 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
|
2024-04-21 13:52:40 +00:00
|
|
|
config.json: $(YQ)
|
|
|
|
$(YQ) -ojson . config.yaml | jq -S . >config.json
|
|
|
|
|
|
|
|
create-snapshot: config.json $(ENVRUN) $(PACKER)
|
|
|
|
$(PACKER) init alpine.pkr.hcl
|
|
|
|
$(ENVRUN) -- $(PACKER) build -var-file=config.json alpine.pkr.hcl
|
2022-12-17 00:05:27 +00:00
|
|
|
|
2023-03-02 18:10:12 +00:00
|
|
|
# --- Tools
|
|
|
|
|
2024-04-21 13:52:40 +00:00
|
|
|
tools: $(ENVRUN) $(PACKER) $(YQ)
|
|
|
|
|
|
|
|
$(ENVRUN):
|
|
|
|
rm envrun_*
|
|
|
|
curl -sSfL "https://github.com/Luzifer/envrun/releases/download/v$(ENVRUN_VERSION)/envrun_linux_amd64.tar.gz" | tar -xz
|
2023-03-02 18:10:12 +00:00
|
|
|
mv envrun_linux_amd64 $@
|
|
|
|
|
2024-04-21 13:52:40 +00:00
|
|
|
$(PACKER):
|
|
|
|
rm packer_*
|
|
|
|
curl -sSfLo packer.zip "https://releases.hashicorp.com/packer/$(PACKER_VERSION)/packer_$(PACKER_VERSION)_linux_amd64.zip"
|
|
|
|
unzip packer.zip
|
|
|
|
rm packer.zip
|
|
|
|
mv packer $@
|
|
|
|
|
|
|
|
$(YQ):
|
|
|
|
rm yq_*
|
|
|
|
curl -sSfLo $@ "https://github.com/mikefarah/yq/releases/download/v$(YQ_VERSION)/yq_linux_amd64"
|
2023-03-02 18:10:12 +00:00
|
|
|
chmod +x $@
|
|
|
|
|
2022-12-17 00:05:27 +00:00
|
|
|
.PHONY: config.json
|