feat: add docker build commands to Makefile

This commit is contained in:
Sakurasan
2026-09-01 15:22:37 +08:00
parent 19232567f2
commit c65d497551
3 changed files with 22 additions and 3 deletions
+20 -1
View File
@@ -1,4 +1,4 @@
.PHONY: build run test clean fmt lint frontend dev dev-backend dev-frontend
.PHONY: build run test clean fmt lint frontend dev dev-backend dev-frontend docker docker-cn docker-multi
BINARY_NAME=openteam
BUILD_DIR=bin
@@ -8,6 +8,10 @@ BACKEND_DIR=backend
build: frontend
cd $(BACKEND_DIR) && CGO_ENABLED=0 go build -o ../$(BUILD_DIR)/$(BINARY_NAME) ./cmd/openteam
# Build backend only (frontend dist must exist)
build-backend:
cd $(BACKEND_DIR) && CGO_ENABLED=0 go build -o ../$(BUILD_DIR)/$(BINARY_NAME) ./cmd/openteam
# Build frontend and copy dist
frontend:
cd frontend && pnpm install && pnpm build
@@ -74,3 +78,18 @@ migrate:
# Seed data (will be implemented)
seed:
@echo "Seeding will be implemented in future"
# Docker build (default platform)
docker:
docker build -f deploy/docker/Dockerfile -t $(BINARY_NAME):latest .
# Docker build (China mirror accelerated)
docker-cn:
docker build -f deploy/docker/Dockerfile.cn -t $(BINARY_NAME):latest .
# Docker build multi-platform (requires: docker buildx)
docker-multi:
docker buildx build -f deploy/docker/Dockerfile \
--platform linux/amd64,linux/arm64 \
-t $(BINARY_NAME):latest --push .
+1 -1
View File
@@ -23,7 +23,7 @@ ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH
RUN make build
RUN make build-backend
FROM alpine:latest AS runner
# 设置alpine 时间为上海时间
+1 -1
View File
@@ -27,7 +27,7 @@ ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH
RUN make build
RUN make build-backend
FROM alpine:latest AS runner
# 设置alpine 时间为上海时间