瀏覽代碼

chore: add Docker build and push commands to Makefile

- Add docker-build target for building Docker images
- Add docker-push target for building and pushing images
- Dynamic tag format: {registry}:{timestamp}-{branch}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat/alipay-payment
fengsilin 1 月之前
父節點
當前提交
53f5522299
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. +15
    -1
      makefile

+ 15
- 1
makefile 查看文件

@@ -1,7 +1,7 @@
FRONTEND_DIR = ./web
BACKEND_DIR = .

.PHONY: all build-frontend start-backend
.PHONY: all build-frontend start-backend docker-build docker-push

all: build-frontend start-backend

@@ -12,3 +12,17 @@ build-frontend:
start-backend:
@echo "Starting backend dev server..."
@cd $(BACKEND_DIR) && go run main.go &

# Docker 配置
DOCKER_REGISTRY := registry.cn-hangzhou.aliyuncs.com/fengsilin/new-api
BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//-/g')
BUILD_TIME := $(shell date +%Y%m%d%H%M)
DOCKER_TAG := $(DOCKER_REGISTRY):$(BUILD_TIME)-$(BRANCH_NAME)

docker-build:
@echo "Building Docker image with tag: $(DOCKER_TAG)"
docker build -t $(DOCKER_TAG) .

docker-push: docker-build
@echo "Pushing Docker image: $(DOCKER_TAG)"
docker push $(DOCKER_TAG)

Loading…
取消
儲存