commit b1376a8c09655c767f1cc52555c478cd693358a7 parent 4c15ffc5c2c9143c83c9f34b47ff5f5fcefa2e46 Author: pyratebeard <root@pyratebeard.net> Date: Mon, 24 Jan 2022 23:38:43 +0000 docker and terraform makefiles Diffstat:
A | docker | | | 16 | ++++++++++++++++ |
A | terraform | | | 22 | ++++++++++++++++++++++ |
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/docker b/docker @@ -0,0 +1,16 @@ +override TAG = $(shell basename $$PWD) +VER := latest +IMAGE_ID = $(shell eval sudo docker images -qa ${TAG} | head -n 1) + +build: + sudo docker build -t ${TAG}:${VER} . + +test: + sudo docker run -d ${TAG}:${VER} + +buildtest: build test + +deploy: + @echo ${IMAGE_ID} + sudo docker tag ${IMAGE_ID} pyratebeard/${TAG}:${VER} + sudo docker push pyratebeard/${TAG}:${VER} diff --git a/terraform b/terraform @@ -0,0 +1,22 @@ +NAME := test +VARS := terraform + +init: +· terraform init + +plan: init +· terraform plan -var-file=${VARS}.tfvars -out ${NAME}.tfplan + +apply: +· terraform apply -auto-approve -state-out=${NAME}.tfstate ${NAME}.tfplan + +planapply: init plan apply + +refresh: +· terraform refresh -state=${NAME}.tfstate + +destroy: refresh +· terraform destroy -var-file=${VARS}.tfvars -state=${NAME}.tfstate + +clean: destroy +· rm -f ${NAME}.tf{plan,state{,.backup}}