QSLY commited on
Commit
acdd850
·
verified ·
1 Parent(s): 327f87a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -24
Dockerfile CHANGED
@@ -1,29 +1,15 @@
 
1
 
2
- import (
3
- "log"
4
- "net/http"
5
- "net/http/httputil"
6
- "net/url"
7
- )
8
 
9
- func main() {
10
- // 创建反向代理对象
11
- proxy := httputil.NewSingleHostReverseProxy(&url.URL{
12
- Scheme: "https",
13
- Host: "enka.network",
14
- })
15
 
16
- // 设置处理代理请求的函数
17
- http.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
18
- // 在请求头中添加自定义信息
19
- req.Header.Add("X-Forwarded-Host", req.Host)
20
- req.Header.Add("X-Forwarded-Proto", "https")
21
- req.Header.Add("X-Forwarded-For", req.RemoteAddr)
22
 
23
- // 执行代理请求
24
- proxy.ServeHTTP(res, req)
25
- })
26
 
27
- // 启动服务器并监听端口
28
- log.Fatal(http.ListenAndServe(":7860", nil))
29
- }
 
1
+ FROM alpine
2
 
3
+ ENV TZ Asia/Shanghai
4
+ ENV DEBIAN_FRONTEND=noninteractive
 
 
 
 
5
 
6
+ RUN apk update && \
7
+ apk add go curl bash
 
 
 
 
8
 
9
+ WORKDIR /XxxX
 
 
 
 
 
10
 
11
+ RUN chmod 777 /XxxX
12
+ RUN mkdir -p /.cache/go-build
13
+ RUN chmod 777 /.cache/go-build
14
 
15
+ CMD curl -o proxy.go "$Token" && go run proxy.go -target=enka.network -listen=0.0.0.0:7860