service-video3/makefile

70 lines
1.4 KiB
Makefile

SHELL := /bin/bash
run:
go run main.go
build:
go build -ldflags "-X main.build=local"
# =========================================================
# Building containers
VERSION :=1.0
all: service
service:
docker build \
-f zarf/docker/Dockerfile \
-t service-amd64:$(VERSION) \
--build-arg BUILD_REF=$(VERSION) \
--build-arg BUILD_DATA=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
.
# =========================================================
# Running from within k8s/kind
KIND_CLUSTER := xiaowei-starter-cluster
kind-up:
kind create cluster \
--image kindest/node:v1.21.1 \
--name $(KIND_CLUSTER) \
--config zarf/k8s/kind/kind-config.yaml
kubectl config set-context --current --namespace service-system
kind-down:
kind delete cluster --name $(KIND_CLUSTER)
kind-status:
kubectl get nodes -o wide
kubectl get svc -o wide
kubectl get pods -o wide
kind-load:
kind load docker-image service-amd64:$(VERSION) --name $(KIND_CLUSTER)
kind-apply:
kustomize build zarf/k8s/kind/service-pod|kubectl apply -f -
kind-logs:
kubectl logs -f -l app=service --all-containers=true
kind-restart:
kubectl rollout restart deployment service-pod
kind-update: all kind-load kind-restart
kind-update-apply: all kind-load kind-apply
kind-describe:
kubectl describe node
kubectl describe svc
kubectl describe deployment service-pod
# =========================================================
# Modules support
tidy:
go mod tidy
go mod vendor