File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed
Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 6262 uses : docker/build-push-action@v3
6363 with :
6464 context : .
65- # platforms: linux/amd64,linux/arm64
6665 platforms : ${{ contains(github.ref, 'alpha') && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
6766 push : true
6867 tags : ${{ steps.meta.outputs.tags }}
69- labels : ${{ steps.meta.outputs.labels }}
68+ labels : ${{ steps.meta.outputs.labels }}
69+ build-args : |
70+ TARGETARCH=${{ startsWith(matrix.platform, 'linux/arm64') && 'arm64' || 'amd64' }}
Original file line number Diff line number Diff line change @@ -14,18 +14,18 @@ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run buil
1414 DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run build --prefix /web/air & \
1515 wait
1616
17- FROM golang AS builder2
17+ FROM golang:alpine AS builder2
1818
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/*
19+ RUN apk add --no-cache \
20+ gcc \
21+ musl-dev \
22+ sqlite-dev \
23+ build-base
2324
2425ENV GO111MODULE=on \
2526 CGO_ENABLED=1 \
2627 GOOS=linux \
27- CGO_CFLAGS="-I/usr/include" \
28- CGO_LDFLAGS="-L/usr/lib"
28+ GOARCH=$TARGETARCH
2929
3030WORKDIR /build
3131
@@ -35,14 +35,11 @@ RUN go mod download
3535COPY . .
3636COPY --from=builder /web/build ./web/build
3737
38- RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)'" -o one-api
38+ RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -linkmode external -extldflags '-static' " -o one-api
3939
40- # Final runtime image
41- FROM ubuntu:22.04
40+ FROM alpine:latest
4241
43- RUN apt-get update && apt-get install -y --no-install-recommends \
44- ca-certificates tzdata bash \
45- && rm -rf /var/lib/apt/lists/*
42+ RUN apk add --no-cache ca-certificates tzdata
4643
4744COPY --from=builder2 /build/one-api /
4845
You can’t perform that action at this time.
0 commit comments