Skip to content

Commit 0d5318b

Browse files
committed
revert: fix: revert sqlite build related changes
This reverts commit db65db2.
1 parent db65db2 commit 0d5318b

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

Dockerfile

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,48 @@ WORKDIR /web
44
COPY ./VERSION .
55
COPY ./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

2324
ENV 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

2730
WORKDIR /build
31+
2832
ADD go.mod go.sum ./
2933
RUN go mod download
34+
3035
COPY . .
3136
COPY --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

4147
COPY --from=builder2 /build/one-api /
48+
4249
EXPOSE 3000
4350
WORKDIR /data
4451
ENTRYPOINT ["/one-api"]

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require (
3030
google.golang.org/api v0.187.0
3131
gorm.io/driver/mysql v1.5.6
3232
gorm.io/driver/postgres v1.5.7
33-
gorm.io/driver/sqlite v1.5.5
33+
gorm.io/driver/sqlite v1.5.1
3434
gorm.io/gorm v1.25.10
3535
)
3636

@@ -82,7 +82,7 @@ require (
8282
github.com/kr/text v0.2.0 // indirect
8383
github.com/leodido/go-urn v1.4.0 // indirect
8484
github.com/mattn/go-isatty v0.0.20 // indirect
85-
github.com/mattn/go-sqlite3 v1.14.22 // indirect
85+
github.com/mattn/go-sqlite3 v1.14.24 // indirect
8686
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
8787
github.com/modern-go/reflect2 v1.0.2 // indirect
8888
github.com/pelletier/go-toml/v2 v2.2.2 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
163163
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
164164
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
165165
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
166-
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
167-
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
166+
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
167+
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
168168
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
169169
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
170170
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -306,8 +306,8 @@ gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
306306
gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
307307
gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM=
308308
gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA=
309-
gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E=
310-
gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE=
309+
gorm.io/driver/sqlite v1.5.1 h1:hYyrLkAWE71bcarJDPdZNTLWtr8XrSjOWyjUYI6xdL4=
310+
gorm.io/driver/sqlite v1.5.1/go.mod h1:7MZZ2Z8bqyfSQA1gYEV6MagQWj3cpUkJj9Z+d1HEMEQ=
311311
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
312312
gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s=
313313
gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=

0 commit comments

Comments
 (0)