Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -4
Dockerfile
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
FROM node:16 as builder
|
2 |
|
3 |
WORKDIR /build
|
4 |
-
RUN git clone https://github.com/
|
5 |
-
RUN wget -qO- -t1 -T2 "https://api.github.com/repos/
|
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("/api/v1|g' /build/router/relay-router.go
|
12 |
-
RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/
|
13 |
|
14 |
WORKDIR /build/web
|
15 |
RUN npm install
|
@@ -28,13 +28,17 @@ RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldfl
|
|
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 |
EXPOSE 3000
|
38 |
WORKDIR /data
|
39 |
RUN chmod 777 -R /data
|
40 |
-
ENTRYPOINT
|
|
|
|
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("/api/v1|g' /build/router/relay-router.go
|
12 |
+
RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/constant/relay_mode.go
|
13 |
|
14 |
WORKDIR /build/web
|
15 |
RUN npm install
|
|
|
28 |
|
29 |
FROM alpine
|
30 |
|
31 |
+
ENV CF_TOKEN=token
|
32 |
+
|
33 |
RUN apk update \
|
34 |
&& apk upgrade \
|
35 |
&& apk add --no-cache ca-certificates tzdata \
|
36 |
&& update-ca-certificates 2>/dev/null || true
|
37 |
|
38 |
COPY --from=builder2 /build/one-api /
|
39 |
+
COPY --from=cloudflare/cloudflared:latest /usr/local/bin/cloudflared /usr/local/bin/cloudflared
|
40 |
EXPOSE 3000
|
41 |
WORKDIR /data
|
42 |
RUN chmod 777 -R /data
|
43 |
+
ENTRYPOINT cloudflared tunnel --no-autoupdate run --token $CF_TOKEN & \
|
44 |
+
/one-api
|