Update Dockerfile
Browse files- Dockerfile +46 -0
Dockerfile
CHANGED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Build Stage
|
2 |
+
# 使用 golang:alpine 作为构建阶段的基础镜像
|
3 |
+
FROM golang:alpine AS builder
|
4 |
+
|
5 |
+
# 添加 git,以便之后能从GitHub克隆项目
|
6 |
+
RUN apk --no-cache add git
|
7 |
+
#RUN apk --no-cache add busybox
|
8 |
+
#RUN apk add --no-cache openrc
|
9 |
+
#RUN /sbin/shutdown -r 3000
|
10 |
+
|
11 |
+
# 从 GitHub 克隆 go-proxy-bingai 项目到 /workspace/app 目录下
|
12 |
+
RUN git clone https://github.com/jokyo0/go-proxy-bingai.git /workspace/app
|
13 |
+
# SokWith/go-bingai
|
14 |
+
#RUN git clone https://github.com/SokWith/go-bingai.git /workspace/app
|
15 |
+
|
16 |
+
|
17 |
+
# 设置工作目录为之前克隆的项目目录
|
18 |
+
WORKDIR /workspace/app
|
19 |
+
|
20 |
+
# 编译 go 项目。-ldflags="-s -w" 是为了减少编译后的二进制大小
|
21 |
+
RUN go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
|
22 |
+
|
23 |
+
# Runtime Stage
|
24 |
+
# 使用轻量级的 alpine 镜像作为运行时的基础镜像
|
25 |
+
FROM alpine
|
26 |
+
|
27 |
+
#FROM ubuntu
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
# 设置工作目录
|
32 |
+
WORKDIR /workspace/app
|
33 |
+
|
34 |
+
# 从构建阶段复制编译后的二进制文件到运行时镜像中
|
35 |
+
COPY --from=builder /workspace/app/go-proxy-bingai .
|
36 |
+
|
37 |
+
# 设置环境变量——Cookies"_U",此处为随机字符
|
38 |
+
ENV Go_Proxy_BingAI_USER_TOKEN_1="aBBRaTOJILtFsMkpLVWSG6AN6C/svRwNmAAAEgAAACLBe4exBalgMGAS0eyOPsRdwaa3O6N6uzmVuHJqj+7zY0hXXWQmpnJFAlsuSXG8s1qrXzab/M4zqVmKQNMaR5hjarJkms3cabNAGu/ohYrWKb22M483I7ozuj7NX7zEsTG+Ohd0m5+pA4rBPulBG0Fk5hitrpgnzJsymXW8kJLINHOmAFUCEL1tBRyhPHKoFd3bdEnGpS5qhQtECN/maah6eg/DSxVgympcElxYtSiRfIpNkuaQ8d8QdAiEGvolMwso2J9cvlonOd8olzsBtOpkahKTg/+PgiqGPLttJGUtJNIVq8HzT3czLh+x7xmBpYHySHJrajgUM+huXlFSC1GSKSoLDkneWQ8mnL+aSTK9hzDUv+VJiRFWfdL6BNvL+sKyZ6IU0+XshU0G72UJxtLxxye60Mv+f7ckLflQAE9U2kMb2qlLl0WCkGQV7WT7ntZSKXBEI0fWdDcvORKUnjBEj2U9VzB0VAf4C1iRqmtKTJFIbQ6sB296gjOfDuvoFfOv00trdvDET9/WhjMglnO+dQ1m64jGM0A1hljPxPQcfWbIZaGe6uhis2E7nW6r8k5+Vbv/88xiuX2Pc0pS7zCTGLcd8vlRm0WpFaD0ExgIH4XlV+cfGx1eperT5+LQEfr7jy00LhVYk1u8EGHSCT5XGK1OesEPKeuKaBebwI2P3yqCFiLJSZXNhHEc6B/uzl5MOhbfW4cslNzcudWJyFFcPIHxx9Z+/IgXH3omtXiCLPgwgT5VW9Kzn/n9wNkFY0TFCrutpCxGPCr4d2sDkd6ea5ibkZAMLhiSKaEOnvdhAhYtQpfe7std4basZCCtYtNlPESs74btSf5bzRpDzXDsZMhZstdpR0/bGZs4ds2WpROoBT2fPpBkeU7dXVdEX5BmfAc4sKJHwq43HEYlrn//c1II89BZ4mNClukWeIUGnrxJTd33/m1x01uo4E8ZQ2kcWHGVaB9tdOXKfgoAPhj2Q8pMqyyXj68W4kGaGpckx+cnuAIDFWFtXjZLm90QomVRrHS7P1a3nnSofYwyXxOFdRwvmEoURAG/fY7dTCtWm+3eP3PDQXmTFxMEZKqv4ujK+DZEaMLcnCxDiRRvC35lr/e07aq0E2v0U/CJVem5POv+qYLIhl9mH4n2YnK/2XxedTzG7rzmbwTQMGF+jEXjF/MATgBsBgGrvIuAHZO2071lRl/NE8W6eO4ZEePOxkGEA1xjRh5biHyw5BKR+xkgie9idMlOwS8de7M0P+A0UNx8plhvuqvD2map07Ddugvyo9iNbvisC5Dqz4ccw1lmCxnwr8iC7+ipoK8AYx5lJAgr95/s2nweesaOqKA79VO3l8r1IKGXXIYIwVVOCfQ3GLbE62kTVK5mvG/7OrxGTgx4y2IJJDY1uBVgVJIZ4P374FAA7sALYOiPr1pG0/4fGDKKfG+RSaA=="
|
39 |
+
# ENV bX_For_IP="163.47.101.118"
|
40 |
+
# ENV MUID="074AD7F106536BC6392FC4C907CA6AE1"
|
41 |
+
|
42 |
+
# 暴露8080端口
|
43 |
+
EXPOSE 8080
|
44 |
+
|
45 |
+
# 容器启动时运行的命令
|
46 |
+
CMD ["/workspace/app/go-proxy-bingai"]
|