ARG MALTAI_GO_IMAGE=golang:1.26.11-alpine@sha256:ecb67f987aa1a57794c91d19ade7ae0209f2f0f5496aaef9e6ae85ddf92d02ab ARG MALTAI_BUN_IMAGE=oven/bun:1.4.4@sha256:1d22548f177f4ff38e0c15baa3c2c46c6c2060ba2d1bc573bb4720b407548f1d ARG MALTAI_GATEWAY_BASE=calciumion/new-api:v1.0.0-rc.51@sha256:d6effcdbc58175494765c0cc5954bdacb2300516eec79ba1a9c61f9b9fae7b49 FROM ${MALTAI_GO_IMAGE} AS source ADD --checksum=sha256:46c669225f35895ea225c985dc31a0dd05c8fec93799516c57a3766830f975da https://codeload.github.com/QuantumNous/new-api/tar.gz/refs/tags/v1.0.0-rc.51 /tmp/upstream.tar.gz WORKDIR /src COPY dependencies.patch /tmp/dependencies.patch RUN apk add --no-cache patch && tar -xzf /tmp/upstream.tar.gz --strip-components=1 && \ patch -p1 -i /tmp/dependencies.patch && printf '%s' v1.0.0-rc.51 > VERSION FROM ${MALTAI_BUN_IMAGE} AS frontend WORKDIR /src/web COPY --from=source /src/web/ ./ COPY --from=source /src/VERSION /src/VERSION RUN bun install --frozen-lockfile && DISABLE_ESLINT_PLUGIN=true VITE_REACT_APP_VERSION=v1.0.0-rc.51 bun run build && bun pm cache rm && rm -r node_modules FROM source AS binary ARG MALTAI_GO_PROXY=https://proxy.golang.org,direct ENV CGO_ENABLED=0 GOWORK=off GOPROXY=${MALTAI_GO_PROXY} COPY --from=frontend /src/web/dist /src/web/dist RUN go mod download && go build -mod=readonly -trimpath -pgo="$(go list -m -f '{{.Dir}}' github.com/MoeForge/moejs)/default.pgo" -ldflags="-s -w -X github.com/QuantumNous/new-api/common.Version=v1.0.0-rc.51" -o /new-api . && go clean -cache -modcache FROM ${MALTAI_GATEWAY_BASE} RUN sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources && \ apt-get -o APT::Update::Error-Mode=any update && \ DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends upgrade && \ apt-get clean && rm -rf /var/lib/apt/lists/* COPY --from=binary /new-api /new-api COPY dependencies.patch /licenses/maltai-dependencies.patch LABEL cc.maltai.upstream.revision="c9c6da2786b6a0912215127e78e28fbc6650c85f" \ cc.maltai.modifications="Security dependency and toolchain updates. See /licenses/maltai-dependencies.patch."