init: 基础部署文件(项目可参考)
This commit is contained in:
70
makefile
Normal file
70
makefile
Normal file
@@ -0,0 +1,70 @@
|
||||
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
|
||||
Reference in New Issue
Block a user