0a9bb53f80
CI / docker (push) Successful in 2m7s
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress, ingress key governance, monitoring, and security controls. Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.2 KiB
Docker
72 lines
2.2 KiB
Docker
# Luminary AI Gateway(Go + Vue 管理台)
|
||
#
|
||
# 构建:
|
||
# docker build -t luminary:latest .
|
||
#
|
||
# 运行:
|
||
# docker run -d --name luminary \
|
||
# -p 8293:8293 \
|
||
# -v luminary-data:/data \
|
||
# luminary:latest
|
||
#
|
||
# 生产镜像由 Gitea Actions 构建,见 README 与 .gitea/README.md
|
||
|
||
# syntax=docker/dockerfile:1
|
||
|
||
# 基础镜像默认 Docker Hub;CI 默认 1Panel 加速(docker.1panel.live),本地可传:
|
||
# docker build --build-arg IMAGE_PREFIX=docker.1panel.live/library/ -t luminary:latest .
|
||
ARG IMAGE_PREFIX=
|
||
|
||
FROM --platform=$BUILDPLATFORM ${IMAGE_PREFIX}node:20-alpine AS web-builder
|
||
|
||
WORKDIR /src/web
|
||
COPY web/package.json web/package-lock.json web/.npmrc ./
|
||
RUN npm ci
|
||
COPY web/src ./src
|
||
COPY web/public ./public
|
||
COPY web/index.html web/tsconfig.json web/vite.config.ts ./
|
||
RUN npm run build
|
||
|
||
FROM --platform=$BUILDPLATFORM ${IMAGE_PREFIX}golang:1.25-alpine AS go-builder
|
||
|
||
ARG TARGETARCH=amd64
|
||
ARG GOPROXY=https://goproxy.cn,direct
|
||
ARG GOSUMDB=sum.golang.google.cn
|
||
ENV CGO_ENABLED=0 GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB}
|
||
|
||
WORKDIR /src
|
||
COPY go.mod go.sum ./
|
||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||
go mod download
|
||
|
||
COPY cmd/ ./cmd/
|
||
COPY internal/ ./internal/
|
||
COPY web/static_embed.go ./web/
|
||
COPY --from=web-builder /src/web/dist ./web/dist
|
||
|
||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||
--mount=type=cache,target=/root/.cache/go-build \
|
||
GOOS=linux GOARCH="$TARGETARCH" \
|
||
go build -trimpath -ldflags="-w -s" -o /luminary ./cmd/luminary \
|
||
&& go build -trimpath -ldflags="-w -s" -o /luminary-recover ./cmd/luminary-recover
|
||
|
||
ARG IMAGE_PREFIX=
|
||
FROM ${IMAGE_PREFIX}alpine:3.20
|
||
|
||
ARG APK_MIRROR=mirrors.aliyun.com
|
||
RUN sed -i "s/dl-cdn.alpinelinux.org/${APK_MIRROR}/g" /etc/apk/repositories \
|
||
&& apk add --no-cache ca-certificates tzdata tini
|
||
|
||
ENV LUMINARY_DATA=/data \
|
||
LUMINARY_ADDR=:8293
|
||
|
||
COPY --from=go-builder /luminary /usr/local/bin/luminary
|
||
COPY --from=go-builder /luminary-recover /usr/local/bin/luminary-recover
|
||
COPY docker/entrypoint.sh /entrypoint.sh
|
||
COPY scripts/luminary-recover.sh /usr/local/bin/luminary-recover.sh
|
||
RUN chmod +x /entrypoint.sh /usr/local/bin/luminary-recover.sh
|
||
|
||
VOLUME ["/data"]
|
||
EXPOSE 8293
|
||
ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
|