Files
new-api/Dockerfile

34 lines
729 B
Docker
Raw Normal View History

2025-01-22 04:21:08 +08:00
FROM oven/bun:latest AS builder
2023-04-22 20:39:27 +08:00
WORKDIR /build
COPY web/package.json .
RUN bun install
2023-04-22 20:39:27 +08:00
COPY ./web .
COPY ./VERSION .
RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat VERSION) bun run build
2023-04-22 20:39:27 +08:00
2025-02-11 18:51:27 +08:00
FROM golang AS builder2
2025-02-11 18:23:20 +08:00
2023-04-22 20:39:27 +08:00
ENV GO111MODULE=on \
2025-02-11 18:51:09 +08:00
CGO_ENABLED=0 \
2023-04-22 20:39:27 +08:00
GOOS=linux
WORKDIR /build
ADD go.mod go.sum ./
RUN go mod download
2023-04-22 20:39:27 +08:00
COPY . .
2024-03-23 21:47:51 +08:00
COPY --from=builder /build/dist ./web/dist
2025-02-11 18:51:09 +08:00
RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
2023-04-22 20:39:27 +08:00
FROM alpine
RUN apk update \
&& apk upgrade \
2025-01-25 12:55:40 +07:00
&& apk add --no-cache ca-certificates tzdata ffmpeg \
2025-01-25 12:58:08 +07:00
&& update-ca-certificates
2023-04-26 13:04:01 +08:00
2023-04-22 21:14:09 +08:00
COPY --from=builder2 /build/one-api /
2023-04-22 20:39:27 +08:00
EXPOSE 3000
WORKDIR /data
2023-04-22 21:14:09 +08:00
ENTRYPOINT ["/one-api"]