|
|
@@ -1,3 +1,5 @@ |
|
|
|
|
|
# syntax=docker/dockerfile:1 |
|
|
|
|
|
|
|
|
FROM oven/bun:latest AS builder |
|
|
FROM oven/bun:latest AS builder |
|
|
|
|
|
|
|
|
# 使用淘宝镜像加速 |
|
|
# 使用淘宝镜像加速 |
|
|
@@ -6,7 +8,7 @@ ENV BUN_INSTALL_REGISTRY=https://registry.npmmirror.com |
|
|
WORKDIR /build |
|
|
WORKDIR /build |
|
|
COPY web/package.json . |
|
|
COPY web/package.json . |
|
|
COPY web/bun.lock . |
|
|
COPY web/bun.lock . |
|
|
RUN bun install |
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/root/.bun/install/cache bun install |
|
|
COPY ./web . |
|
|
COPY ./web . |
|
|
COPY ./VERSION . |
|
|
COPY ./VERSION . |
|
|
RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat VERSION) bun run build |
|
|
RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat VERSION) bun run build |
|
|
@@ -22,11 +24,11 @@ ENV GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} |
|
|
WORKDIR /build |
|
|
WORKDIR /build |
|
|
|
|
|
|
|
|
ADD go.mod go.sum ./ |
|
|
ADD go.mod go.sum ./ |
|
|
RUN go mod download |
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download |
|
|
|
|
|
|
|
|
COPY . . |
|
|
COPY . . |
|
|
COPY --from=builder /build/dist ./web/dist |
|
|
COPY --from=builder /build/dist ./web/dist |
|
|
RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api |
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api |
|
|
|
|
|
|
|
|
FROM debian:bookworm-slim |
|
|
FROM debian:bookworm-slim |
|
|
|
|
|
|
|
|
|