Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorax-neo committed Jan 28, 2024
1 parent 1339e8e commit 89aaabf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 使用 Golang 镜像作为构建阶段
FROM golang AS builder

# 设置环境变量
ENV GO111MODULE=on CGO_ENABLED=0 GOOS=linux

# 设置工作目录
WORKDIR /coze-chat-proxy

# 复制 go.mod 和 go.sum 文件,先下载依赖
COPY go.mod go.sum ./
ENV GOPROXY=https://goproxy.cn,direct
RUN go mod download

# 复制整个项目并构建可执行文件
COPY . .
RUN go build -o /coze-chat-proxy

##############################################

# 使用 Alpine 镜像作为最终镜像
FROM alpine

# 安装基本的运行时依赖
RUN apk --no-cache add ca-certificates tzdata

# 从构建阶段复制可执行文件
COPY --from=builder /coze-chat-proxy .

# 暴露端口
EXPOSE 8080

# 工作目录
WORKDIR /data

# 设置入口命令
ENTRYPOINT ["/coze-chat-proxy"]

0 comments on commit 89aaabf

Please sign in to comment.