@@ -4,41 +4,48 @@ WORKDIR /web
44COPY ./VERSION .
55COPY ./web .
66
7- WORKDIR /web/default
8- RUN npm install
9- RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
7+ RUN npm install --prefix /web/default & \
8+ npm install --prefix /web/berry & \
9+ npm install --prefix /web/air & \
10+ wait
1011
11- WORKDIR /web/berry
12- RUN npm install
13- RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
12+ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/default & \
13+ DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/berry & \
14+ DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \
15+ wait
1416
15- WORKDIR /web/air
16- RUN npm install
17- RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build
17+ FROM golang AS builder2
1818
19- FROM golang:alpine AS builder2
20-
21- RUN apk add --no-cache g++
19+ RUN apt-get update && apt-get install -y --no-install-recommends \
20+ build-essential \
21+ sqlite3 libsqlite3-dev \
22+ && rm -rf /var/lib/apt/lists/*
2223
2324ENV GO111MODULE=on \
2425 CGO_ENABLED=1 \
25- GOOS=linux
26+ GOOS=linux \
27+ CGO_CFLAGS="-I/usr/include" \
28+ CGO_LDFLAGS="-L/usr/lib"
2629
2730WORKDIR /build
31+
2832ADD go.mod go.sum ./
2933RUN go mod download
34+
3035COPY . .
3136COPY --from=builder /web/build ./web/build
32- RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
3337
34- FROM alpine
38+ RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)'" -o one-api
3539
36- RUN apk update \
37- && apk upgrade \
38- && apk add --no-cache ca-certificates tzdata \
39- && update-ca-certificates 2>/dev/null || true
40+ # Final runtime image
41+ FROM ubuntu:22.04
42+
43+ RUN apt-get update && apt-get install -y --no-install-recommends \
44+ ca-certificates tzdata bash \
45+ && rm -rf /var/lib/apt/lists/*
4046
4147COPY --from=builder2 /build/one-api /
48+
4249EXPOSE 3000
4350WORKDIR /data
4451ENTRYPOINT ["/one-api" ]
0 commit comments