Files
Luminary/Dockerfile
T
renjue a32547a43e
CI / docker (push) Failing after 3m53s
Fix Docker runtime stage APK_MIRROR default for apk install.
ARG before FROM is not visible in RUN; set APK_MIRROR default inside the
runtime stage so sed does not produce broken https:///alpine URLs in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 21:16:43 +08:00

72 lines
2.2 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Luminary AI GatewayGo + 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 HubCI 默认 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 web/src
COPY web/public web/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"]