Files
MonkeyCode/backend/Makefile

41 lines
1.1 KiB
Makefile
Raw Normal View History

2025-06-25 15:25:18 +08:00
PLATFORM=linux/amd64
TAG=main
2025-06-27 14:59:30 +08:00
OUTPUT=type=docker,dest=${HOME}/tmp/monkeycode_server.tar
GOCACHE=${HOME}/.cache/go-build
GOMODCACHE=${HOME}/go/pkg/mod
2025-06-25 15:25:18 +08:00
REGISTRY=monkeycode.chaitin.cn/monkeycode
2025-07-21 16:45:39 +08:00
VERSION=dev-${shell git rev-parse HEAD}
BUILD_TIME=${shell date -u +"%Y-%m-%dT%H:%M:%SZ"}
GIT_COMMIT=${shell git rev-parse HEAD}
2025-06-25 15:25:18 +08:00
# make build PLATFORM= TAG= OUTPUT= GOCACHE=
image:
docker buildx build \
-f build/Dockerfile \
--build-arg GOCACHE=${GOCACHE} \
--build-arg GOMODCACHE=${GOMODCACHE} \
--build-arg REPO_COMMIT=$(shell git rev-parse HEAD) \
2025-07-21 16:45:39 +08:00
--build-arg VERSION=${VERSION} \
--build-arg BUILD_TIME=${BUILD_TIME} \
--build-arg GIT_COMMIT=${GIT_COMMIT} \
2025-06-25 15:25:18 +08:00
--platform ${PLATFORM} \
--tag ${REGISTRY}/backend:${TAG} \
--output ${OUTPUT} \
.
image-nginx:
docker buildx build \
-f build/Dockerfile.nginx \
--platform ${PLATFORM} \
--tag ${REGISTRY}/nginx:${TAG} \
--output ${OUTPUT} \
.
wire:
wire cmd/server/wire.go cmd/server/main.go
swag:
swag fmt -d internal && swag init --pd -g cmd/server/main.go -ot "json"
migrate_sql:
migrate create -ext sql -dir migration -seq ${SEQ}