wIK5Ez2o commited on
Commit
98f0a6a
·
verified ·
1 Parent(s): 937f5bb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +44 -2
Dockerfile CHANGED
@@ -1,6 +1,48 @@
1
- FROM justsong/one-api:latest
2
 
3
- RUN chmod -R 777 /data
 
 
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  EXPOSE 3000
 
6
  ENTRYPOINT ["/one-api"]
 
1
+ FROM --platform=$BUILDPLATFORM node:16 AS builder
2
 
3
+ WORKDIR /
4
+ RUN git clone https://github.com/songquanpeng/one-api.git -b v0.6.8 .
5
+ WORKDIR /web
6
+ RUN cp /VERSION .
7
 
8
+ WORKDIR /web/default
9
+ RUN npm install
10
+ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
11
+
12
+ WORKDIR /web/berry
13
+ RUN npm install
14
+ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
15
+
16
+ WORKDIR /web/air
17
+ RUN npm install
18
+ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
19
+
20
+ FROM golang:alpine AS builder2
21
+
22
+ RUN apk add --no-cache g++
23
+
24
+ ENV GO111MODULE=on \
25
+ CGO_ENABLED=1 \
26
+ GOOS=linux
27
+
28
+ WORKDIR /
29
+ RUN git clone https://github.com/songquanpeng/one-api.git -b v0.6.8 .
30
+
31
+ WORKDIR /build
32
+ ADD /go.mod go.sum ./
33
+ RUN go mod download
34
+ RUN cp -r /* .
35
+ COPY --from=builder /web/build ./web/build
36
+ RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
37
+
38
+ FROM alpine
39
+
40
+ RUN apk update \
41
+ && apk upgrade \
42
+ && apk add --no-cache ca-certificates tzdata \
43
+ && update-ca-certificates 2>/dev/null || true
44
+
45
+ COPY --from=builder2 /build/one-api /
46
  EXPOSE 3000
47
+ WORKDIR /data
48
  ENTRYPOINT ["/one-api"]