feat: Dockerfile1

This commit is contained in:
wolter 2025-12-05 15:08:28 +08:00
parent 325ea8d78c
commit 0f9ac06f73
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,9 @@ COPY . .
COPY go.mod go.sum ./
RUN go mod download
RUN go install github.com/google/wire/cmd/wire@latest
RUN wire ./cmd/server
# 编译Go应用程序生成静态链接的二进制文件
RUN go build -ldflags="-s -w" -o server ./cmd/server
@ -35,6 +38,9 @@ WORKDIR /app
# 将编译好的二进制文件从构建阶段复制到运行阶段
COPY --from=builder /app/server ./server
# 复制配置文件夹
COPY --from=builder /app/config ./config
ENV TZ=Asia/Shanghai
# 设置容器启动时运行的命令

View File

@ -33,6 +33,6 @@ docker run -itd \
-e "OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}" \
-e "MODE=${MODE}" \
-p 8090:8090 \
"${CONTAINER_NAME}" ./bin/server --config "./${CONFIG_FILE}"
"${CONTAINER_NAME}" ./server --config "./${CONFIG_FILE}"
docker logs -f ${CONTAINER_NAME}