rexcloaa commited on
Commit
9eca220
·
verified ·
1 Parent(s): abbd383

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -32
Dockerfile CHANGED
@@ -1,44 +1,35 @@
1
- # 第一阶段:构建
2
  FROM golang:1.21-alpine AS builder
3
 
4
  WORKDIR /app
 
 
5
 
6
- RUN apk add --no-cache git make
7
-
8
- # 克隆仓库
9
- RUN git clone https://github.com/bincooo/chatgpt-adapter.git .
10
-
11
- # 列出文件,检查项目结构
12
- RUN ls -l
13
-
14
- # 显示 Makefile 内容
15
- RUN cat Makefile
16
-
17
- # 下载依赖
18
- RUN go mod download
19
-
20
- # 尝试使用 Makefile 中的 build-linux 目标
21
- RUN make build-linux || \
22
- (go build -o /app/bin/linux/server cmd/command.go)
23
-
24
- # 第二阶段:运行
25
- FROM alpine:3.19.0
26
 
27
  WORKDIR /app
28
-
29
  COPY --from=builder /app/bin/linux/server ./server
30
- COPY --from=builder /app/config.yaml ./config.yaml
 
31
 
32
- RUN chmod +x server
 
33
 
34
- # 创建日志目录并设置权限
35
- RUN mkdir -p /app/log && chmod 777 /app/log
 
 
 
36
 
37
- # 暴露 8080 端口
38
- EXPOSE 8080
 
 
 
39
 
40
- # 设置环境变量
41
- ENV ARG "--port 8080"
 
42
 
43
- # 设置启动命令
44
- CMD ["sh", "-c", "./server ${ARG}"]
 
 
 
1
  FROM golang:1.21-alpine AS builder
2
 
3
  WORKDIR /app
4
+ RUN apk add git make && git clone https://github.com/bincooo/chatgpt-adapter.git .
5
+ RUN make build-linux
6
 
7
+ FROM ubuntu:latest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  WORKDIR /app
 
10
  COPY --from=builder /app/bin/linux/server ./server
11
+ COPY --from=builder /app/bin/config.yaml ./config.yaml
12
+ COPY --from=builder /app/you-helper.zip ./you-helper.zip
13
 
14
+ RUN apt update \
15
+ && apt-get install -y curl unzip wget gnupg2
16
 
17
+ # Install google
18
+ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
19
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
20
+ && apt-get update \
21
+ && apt-get install -y google-chrome-stable
22
 
23
+ # Install Edge
24
+ #RUN wget -q -O - https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg >/dev/null \
25
+ # && echo "deb https://packages.microsoft.com/repos/edge stable main" >> /etc/apt/sources.list.d/microsoft-edge.list \
26
+ # && apt-get update -qqy \
27
+ # && apt-get -qqy --no-install-recommends install microsoft-edge-stable
28
 
29
+ RUN unzip ./you-helper.zip \
30
+ && chmod +x server \
31
+ && chmod +x bin/linux/helper
32
 
33
+ ENV ARG "--port 8080"
34
+ CMD ["./server ${ARG}"]
35
+ ENTRYPOINT ["sh", "-c"]