Add Makefile commands for one-command Docker deployment

This commit is contained in:
2026-03-09 00:28:27 +08:00
parent e5b9399350
commit 939b2ff287
2 changed files with 54 additions and 10 deletions

33
Makefile Normal file
View File

@@ -0,0 +1,33 @@
.PHONY: help build up down restart logs ps
COMPOSE_FILE := docker/docker-compose.yml
COMPOSE := docker compose -f $(COMPOSE_FILE)
help:
@printf "Available targets:\n"
@printf " make build Build Docker images\n"
@printf " make up Build and start services in background\n"
@printf " make down Stop and remove services\n"
@printf " make restart Restart services\n"
@printf " make logs Follow service logs\n"
@printf " make ps Show service status\n"
build:
$(COMPOSE) build
up:
$(COMPOSE) build
$(COMPOSE) up -d
down:
$(COMPOSE) down
restart:
$(COMPOSE) down
$(COMPOSE) up -d
logs:
$(COMPOSE) logs -f
ps:
$(COMPOSE) ps

View File

@@ -12,6 +12,9 @@
在**项目根目录**执行:
```bash
# 一键(推荐)
make up
# 构建镜像
docker compose -f docker/docker-compose.yml build
@@ -22,6 +25,14 @@ docker compose -f docker/docker-compose.yml up
docker compose -f docker/docker-compose.yml up -d
```
常用命令:
```bash
make logs # 查看日志
make ps # 查看状态
make down # 停止并移除容器
```
访问http://localhost:48080
## 环境变量(可选)