smgc commited on
Commit
f778831
1 Parent(s): 09cff0a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -1
Dockerfile CHANGED
@@ -1 +1,39 @@
1
- FROM ghcr.io/martialbe/one-api:latest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:16 as builder
2
+
3
+ WORKDIR /app
4
+ RUN git clone https://github.com/MartialBE/one-api.git .
5
+ RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /app/router/relay-router.go
6
+
7
+ WORKDIR /build
8
+ COPY /app/web/package.json .
9
+ RUN npm install
10
+ COPY /app/web .
11
+ COPY /app/VERSION .
12
+ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
13
+
14
+
15
+ FROM golang AS builder2
16
+
17
+ ENV GO111MODULE=on \
18
+ CGO_ENABLED=1 \
19
+ GOOS=linux
20
+
21
+ WORKDIR /build
22
+ RUN git clone https://github.com/MartialBE/one-api.git .
23
+ RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /app/router/relay-router.go
24
+ RUN go mod download
25
+ COPY --from=builder /build/build ./web/build
26
+ RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
27
+
28
+ FROM alpine
29
+
30
+ RUN apk update \
31
+ && apk upgrade \
32
+ && apk add --no-cache ca-certificates tzdata \
33
+ && update-ca-certificates 2>/dev/null || true
34
+
35
+ COPY --from=builder2 /build/one-api /
36
+ EXPOSE 3000
37
+ WORKDIR /data
38
+ RUN chmod 777 -R /data
39
+ ENTRYPOINT ["/one-api"]