iridescentX commited on
Commit
fc4d1f0
·
verified ·
1 Parent(s): bd0250d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -11
Dockerfile CHANGED
@@ -1,17 +1,15 @@
1
  FROM node:16 as builder
2
 
3
  WORKDIR /build
4
- RUN git clone https://github.com/Calcium-Ion/new-api.git .
5
- RUN wget -qO- -t1 -T2 "https://api.github.com/repos/Calcium-Ion/new-api/releases" | \
6
  grep "tag_name" | \
7
  head -n 1 | \
8
  awk -F ":" '{print $2}' | \
9
  sed 's/\"//g;s/,//g;s/ //g' > VERSION
10
 
11
- RUN sed -i'' 's|router.Group("/v1|router.Group("/ai|g' /build/router/relay-router.go
12
- RUN sed -i'' 's|RequestURI, "/v1|RequestURI, "/ai|g' /build/router/web-router.go
13
- RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/ai|g' /build/relay/constant/relay_mode.go
14
-
15
 
16
  WORKDIR /build/web
17
  RUN npm install
@@ -30,17 +28,14 @@ RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldfl
30
 
31
  FROM alpine
32
 
33
- ENV CF_TOKEN=token
34
-
35
  RUN apk update \
36
  && apk upgrade \
37
  && apk add --no-cache ca-certificates tzdata \
38
  && update-ca-certificates 2>/dev/null || true
39
 
40
  COPY --from=builder2 /build/one-api /
41
- COPY --from=cloudflare/cloudflared:latest /usr/local/bin/cloudflared /usr/local/bin/cloudflared
42
  EXPOSE 3000
43
  WORKDIR /data
44
  RUN chmod 777 -R /data
45
- ENTRYPOINT cloudflared tunnel --no-autoupdate run --token $CF_TOKEN & \
46
- /one-api
 
1
  FROM node:16 as builder
2
 
3
  WORKDIR /build
4
+ RUN git clone https://github.com/MartialBE/one-hub.git .
5
+ RUN wget -qO- -t1 -T2 "https://api.github.com/repos/MartialBE/one-hub/releases" | \
6
  grep "tag_name" | \
7
  head -n 1 | \
8
  awk -F ":" '{print $2}' | \
9
  sed 's/\"//g;s/,//g;s/ //g' > VERSION
10
 
11
+ RUN sed -i'' 's|router.Group("/v1|router.Group("/ai/v1|g' /build/router/relay-router.go
12
+ RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/ai/v1|g' /build/relay/common.go
 
 
13
 
14
  WORKDIR /build/web
15
  RUN npm install
 
28
 
29
  FROM alpine
30
 
 
 
31
  RUN apk update \
32
  && apk upgrade \
33
  && apk add --no-cache ca-certificates tzdata \
34
  && update-ca-certificates 2>/dev/null || true
35
 
36
  COPY --from=builder2 /build/one-api /
37
+
38
  EXPOSE 3000
39
  WORKDIR /data
40
  RUN chmod 777 -R /data
41
+ ENTRYPOINT ["/one-api"]