Skip to content

Commit 5961634

Browse files
committed
build(deploy): update Dockerfile and improve build process
- Update DockerfileBuilder to use root user and install protobuf-compiler - Update Dockerfile to copy only necessary files and optimize build process - Modify Makefile to use APP_NAME variable consistently - Update VSCode settings with new environment variables
1 parent a03e8fd commit 5961634

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"errgroup",
5353
"Errorw",
5454
"feishu",
55+
"GOHOSTOS",
5556
"gorm",
5657
"houyi",
5758
"houyiv",
@@ -60,7 +61,10 @@
6061
"merr",
6162
"nicksnyder",
6263
"palacecommon",
64+
"PATHSEP",
65+
"protoc",
6366
"protovalidate",
67+
"PSEP",
6468
"rabbitcommon",
6569
"rabbitconmmon",
6670
"rabbitv",

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ init:
4848
all:
4949
@echo "Initialization of moon project"
5050
@if [ -z "$(APP_NAME)" ]; then echo "app name is required"; echo "usage: make all app=<app_name>"; exit 1; fi
51-
make api app=palace
52-
make api app=houyi
53-
make api app=rabbit
54-
make api app=laurel
51+
APP_NAME=palace make api
52+
APP_NAME=houyi make api
53+
APP_NAME=rabbit make api
54+
APP_NAME=laurel make api
5555
make errors
5656
make conf
5757
make stringer-$(APP_NAME)
@@ -215,14 +215,14 @@ gen-laurel:
215215
build:
216216
@if [ -z "$(APP_NAME)" ]; then echo "app name is required"; echo "usage: make build app=<app_name>"; exit 1; fi
217217
@echo "Building moon app=$(APP_NAME)"
218-
make all
218+
make all app=$(APP_NAME)
219219
mkdir -p bin/ && go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./cmd/$(APP_NAME)
220220

221221
.PHONY: run
222222
run:
223223
@if [ -z "$(APP_NAME)" ]; then echo "app name is required"; echo "usage: make run app=<app_name>"; exit 1; fi
224224
@echo "Running moon app=$(APP_NAME)"
225-
make all
225+
make all app=$(APP_NAME)
226226
go run ./cmd/$(APP_NAME) -c ./cmd/$(APP_NAME)/config
227227

228228
.PHONY: simple-run

deploy/base/DockerfileBuilder

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM golang:1.24.1-bullseye
22

3+
USER root
4+
35
RUN apt update -y \
46
&& apt install -y protobuf-compiler
57

deploy/server/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ ARG APP_NAME=""
44

55
WORKDIR /moon
66

7-
COPY ../../ .
7+
COPY . .
88

9-
RUN make all app=${APP_NAME}
109
RUN make build app=${APP_NAME}
1110

1211
FROM ghcr.io/aide-family/moon:deploy

0 commit comments

Comments
 (0)