sfun commited on
Commit
a9c5264
1 Parent(s): 693ae43

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -33
Dockerfile CHANGED
@@ -1,41 +1,23 @@
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
16
- RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../VERSION) npm run build
17
 
18
- FROM golang AS builder2
 
 
 
 
 
19
 
20
- ENV GO111MODULE=on \
21
- CGO_ENABLED=1 \
22
- GOOS=linux
23
-
24
- WORKDIR /build
25
- COPY --from=builder /build .
26
- RUN go mod download
27
- RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
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"]
 
 
1
+ FROM ghcr.io/martialbe/one-api:latest
2
 
3
+ RUN apk add --no-cache pcre2
 
 
 
 
 
 
4
 
5
+ COPY --from=nginx:alpine /etc/nginx /etc/nginx
6
+ COPY --from=nginx:alpine /usr/sbin/nginx /usr/sbin/nginx
7
 
8
+ COPY nginx.conf /etc/nginx/nginx.conf
 
 
9
 
10
+ RUN mkdir -p /var/log/nginx && \
11
+ mkdir -p /var/cache/nginx && \
12
+ mkdir -p /var/run && \
13
+ chmod -R 777 /var/log/nginx && \
14
+ chmod -R 777 /var/cache/nginx && \
15
+ chmod -R 777 /var/run
16
 
17
+ WORKDIR /data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ EXPOSE 3001
20
 
 
 
21
  RUN chmod 777 -R /data
22
+
23
+ ENTRYPOINT ["sh", "-c", "nginx & /one-api"]