应用 Dockerfile 示例
本页面收集和整理了可用于 AIStudio 镜像中心的部分 Dockerfile 示例。您可以参考这些 Dockerfile,快速构建适用于 AI 开发、部署和实验的镜像环境。每个 Dockerfile 都包含了常用依赖和配置,方便在 AIStudio 平台上直接使用或定制。
Xinference
使用支持高并发的高性能大模型推理引擎 vLLM,可使用以下 Dockerfile 构建镜像。
dockerfile
FROM cr.infini-ai.com/infini-ai/ubuntu:24.04
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ENV UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
RUN rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED && \
pip install --no-cache-dir uv && \
uv pip install --system --verbose --no-cache "xinference[vllm]==1.12.0" && \
uv cache clean && \
rm -rf ~/.cache/pipOne API
dockerfile
FROM cr.infini-ai.com/te-b905754427352261/node:22 AS builder
# 克隆 one-api 代码仓库
WORKDIR /app
RUN git clone https://ghfast.top/https://github.com/songquanpeng/one-api.git .
RUN echo "registry=https://registry.npmmirror.com" > .npmrc
WORKDIR /app/web
WORKDIR /app/web/default
RUN npm install
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../../VERSION) npm run build
WORKDIR /app/web/berry
RUN npm install
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../../VERSION) npm run build
WORKDIR /app/web/air
RUN npm install
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../../VERSION) npm run build
FROM cr.infini-ai.com/te-b905754427352261/golang:alpine AS builder2
RUN apk add --no-cache g++ git
ENV GO111MODULE=on \
CGO_ENABLED=1 \
GOOS=linux \
GOPROXY=https://goproxy.cn,direct
WORKDIR /build
# 从上一个阶段获取构建产物
COPY --from=builder /app/go.mod /app/go.sum ./
RUN go mod download
COPY --from=builder /app/ .
COPY --from=builder /app/web/build ./web/build
RUN go build -trimpath -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
FROM cr.infini-ai.com/te-b905754427352261/alpine:latest
RUN apk update \
&& apk upgrade \
&& apk add --no-cache ca-certificates tzdata \
&& update-ca-certificates 2>/dev/null || true
COPY --from=builder2 /build/one-api /
EXPOSE 3000
WORKDIR /data
CMD ["/bin/sh"]