Files
new-api/Dockerfile

34 lines
762 B
Docker
Raw Normal View History

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
FROM golang AS builder2
ENV GO111MODULE=on \
CGO_ENABLED=1 \
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
2023-12-27 00:19:25 +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 \
&& apk add --no-cache ca-certificates tzdata ffmpeg ffmpeg-tools \
2023-04-22 20:39:27 +08:00
&& update-ca-certificates 2>/dev/null || true
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"]