gen / Dockerfile
rclon's picture
Update Dockerfile
eb69339 verified
raw
history blame contribute delete
742 Bytes
# 使用 Golang 镜像作为构建阶段
FROM golang:alpine AS builder
# 设置环境变量
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux
# 设置工作目录
WORKDIR /build
# 安装 git
RUN apk add --no-cache git \
&& git clone https://github.com/deanxv/genspark2api.git . \
&& sed -i 's|router.Group("/v1")|router.Group("/hf/v1")|' router/api-router.go \
&& go mod download && go build -o /genspark2api
# 使用 Alpine 镜像作为最终镜像
FROM alpine
# 安装基本的运行时依赖
RUN apk --no-cache add ca-certificates tzdata
# 从构建阶段复制可执行文件
COPY --from=builder /genspark2api .
# 工作目录
WORKDIR /app/genspark2api/data
# 设置入口命令
ENTRYPOINT ["/genspark2api"]