recipe

vsiri/recipe Docker Image

vsiri
自动构建

Docker Recipes 是一系列小型 Docker 镜像,用于多阶段构建,帮助避免重复配置常见软件(如 gosu、tini 等)的 Dockerfile 步骤,基于 ONBUILD 设计,作为独立构建阶段使用。

下载次数: 0状态:自动构建维护者:vsiri仓库类型:镜像最近更新:

Docker Recipes

Docker Recipe 是一种(通常非常小的)Docker 镜像,用于多阶段构建中,使您无需反复查找和编写“包含软件 XYZ 的最佳 Dockerfile 代码段”(例如 gosu、tini 等)。它们主要基于 ONBUILD 指令,旨在作为独立构建阶段使用。

示例

dockerfile
Dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:tini as tini
FROM docker.xuanyuan.run/vsiri/recipe:gosu as gosu
FROM docker.xuanyuan.run/debian:9 # 实际业务镜像

RUN echo stuff  # 示例命令

COPY --from=tini /usr/local /usr/local
COPY --from=gosu /usr/local /usr/local

# 所有 recipes 通用的补丁命令
RUN shopt -s nullglob; for patch in /usr/local/share/just/container_build_patch/*; do "${patch}"; done

使用方法

Recipes 可直接从 DockerHub 使用,也可将此仓库作为子模块包含在项目中,直接基于 Dockerfile 构建。

许多 recipes 包含构建参数,用于控制安装的软件版本(通常)。除非使用默认值,否则需在构建时指定这些参数:

  • 使用 docker 时:docker build --build-arg key=val ...
  • 使用 docker compose 时:docker buildx bake --set *.args.key=val ...(建议在 docker-compose.yml 中配置)

注意:无法在 Dockerfile 的全局部分添加 ARG 并期望其默认值影响 recipe,这与 recipe 的工作机制不符。

适用范围说明

这不是一种“包含”或“导入”Dockerfile 的通用方法,仅在特定条件下适用:

  • recipe 的输出可通过 Dockerfile 的 ADD 命令轻松添加
  • 接受通过构建参数自定义版本号
  • 代码具有较好的可移植性(例如静态编译的 Go 程序;Python 虚拟环境不可移植,musl 版本需单独处理,如 tini 和 tini-musl)

可用 Recipes

VSI Common

名称VSI Common
输出目录/vsi

提供 VSI 通用函数,即使使用 just 可执行文件,也能在容器中复制这些函数。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:vsi as vsi
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=vsi /vsi /vsi

tini

名称tini
构建参数TINI_VERSION - 要下载的 tini 版本
输出目录/usr/local

tini 是一个进程收割器,适用于会生成新进程的 Docker 容器。Alpine 版本为 tini-musl。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:tini as tini
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=tini /usr/local /usr/local

gosu

名称gosu
构建参数GOSU_VERSION - 要下载的 gosu 版本
输出目录/usr/local

为 Docker 自动化设计的 sudo 替代工具(无需密码)。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:gosu as gosu

FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=gosu /usr/local /usr/local
# 可选:添加 SUID 位,允许非特权用户以 root 身份运行(类似 sudo)
RUN chmod u+s /usr/local/bin/gosu

ep - envplate

名称ep
构建参数EP_VERSION - 要下载的 ep 版本
输出目录/usr/local

ep 是一种简单工具,可为不支持环境变量替换的应用配置文件提供 Bourne shell 风格的变量替换功能。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:ep as ep
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=ep /usr/local /usr/local

jq - JSON Processor

名称jq
构建参数JQ_VERSION - 要下载的 jq 版本
输出目录/usr/local

jq 是一款轻量级、灵活的命令行 JSON 处理器。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:jq as jq
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=jq /usr/local /usr/local

ninja

名称ninja
构建参数NINJA_VERSION - 要下载的 ninja 版本
输出目录/usr/local

ninja 是 GNU Make 的高效替代工具,用于构建加速。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:ninja as ninja
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=ninja /usr/local /usr/local

Docker

名称Docker
构建参数DOCKER_VERSION - 要下载的 Docker 版本
输出目录/usr/local(包含 docker 及其他文件)

Docker 是用于运行容器应用的工具。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:docker as docker
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=docker /usr/local /usr/local

Docker compose

名称docker compose
构建参数DOCKER_COMPOSE_VERSION - 要下载的 docker compose 版本
输出目录/usr/local

用于简单 Docker 编排的工具,提供组织化方式运行一个或多个容器。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:docker-compose as docker-compose
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=docker-compose /usr/local /usr/local

注意:Docker Compose 2.0.0+ 版本支持 glibc 和 musl;1.x 版本需使用 Alpine 专用镜像:docker/compose:alpine-${DOCKER_COMPOSE_VERSION}。

Alpine 示例:

dockerfile
ARG DOCKER_COMPOSE_VERSION=1.26.2
FROM docker.xuanyuan.run/docker/compose:alpine-${DOCKER_COMPOSE_VERSION} as docker-compose
FROM docker.xuanyuan.run/alpine:3.11
RUN apk add --no-cache git  # 示例命令
COPY --from=docker-compose /usr/local /usr/local

git Large File Support

名称git lfs
构建参数GIT_LFS_VERSION - 要下载的 git-lfs 版本
输出目录/usr/local

git-lfs 使 git 能够优雅处理大文件。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:git-lfs as git-lfs
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=git-lfs /usr/local /usr/local
# 所有 recipes 通用补丁命令(只需运行一次)
RUN shopt -s nullglob; for patch in /usr/local/share/just/container_build_patch/*; do "${patch}"; done

CMake

名称CMake
构建参数CMAKE_VERSION - 要下载的 CMake 版本
输出目录/usr/local

CMake 是跨平台工具集,用于构建、测试和打包软件。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:cmake as cmake
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=cmake /usr/local /usr/local

Pipenv

名称Pipenv
环境变量PIPENV_VERSION - 要下载的 Pipenv 版本
PIPENV_VIRTUALENV - Pipenv 虚拟环境位置
PIPENV_PYTHON - 可选默认 Python 可执行文件路径
输出目录/usr/local

Pipenv 是管理 Python 项目依赖(基于虚拟环境)的新方式。

由于虚拟环境的非可移植性,需在目标镜像中正确位置创建。可通过 PIPENV_VIRTUALENV 参数调整位置。默认 Python 版本可通过 PYTHON 构建参数或 pipenv 命令的 --python/--two/--three 标志指定。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:pipenv as pipenv
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=pipenv /usr/local /usr/local
# 所有 recipes 通用补丁命令(只需运行一次)
RUN shopt -s nullglob; for patch in /usr/local/share/just/container_build_patch/*; do "${patch}"; done

Rocky Repos

名称Rocky Linux Repos
输出目录/usr/local

Rocky Linux 是 RHEL 的免费替代版,此 recipe 用于向 UBI 镜像添加 Rocky 软件源。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:rocky as rocky
FROM docker.xuanyuan.run/redhat/ubi8
COPY --from=rocky /usr/local /usr/local
# 所有 recipes 通用补丁命令(只需运行一次)
RUN shopt -s nullglob; for patch in /usr/local/share/just/container_build_patch/*; do "${patch}"; done

RUN dnf install -y --enablerepo=rocky-appstream telnet  # 示例命令

CUDA

名称CUDA
特殊参数CUDA_REPO_REF - CUDA 容器仓库的引用(通过环境变量 DOCKER_RECIPE_CUDA_REPO_REF 设置,默认:81682547e12c8807ebc5fa61ff4576510925a324)
构建参数CUDA_VERSION - 要安装的 CUDA 版本(如 10.2 或 11.0.7)
CUDNN_VERSION - 可选,要安装的 cuDNN 版本(如 7 或 8)
CUDA_RECIPE_TARGET - 可选,指定安装的 CUDA 组件(runtime/devel/devel-only,默认:runtime)
环境变量NVIDIA_VISIBLE_DEVICES - 必需,设置可见的 NVIDIA 设备(如 all)
NVIDIA_DRIVER_CAPABILITIES - 可选,设备功能(默认:compute,utility)
NVIDIA_REQUIRE_* - 可选,系统兼容性约束
输出目录/usr/local
最低 Dockerfile 前端docker/dockerfile:1.3-labs 或 docker/dockerfile:1.4

当需基于特定镜像(如加固镜像)添加 CUDA 支持时,此 recipe 可自动完成配置步骤(设置仓库、安装包、配置环境变量等)。目前支持 RHEL 和 Ubuntu 基础镜像。

CUDA_RECIPE_TARGET 说明:

  • runtime:仅安装运行时包
  • devel:安装运行时和开发包
  • devel-only:仅安装开发包(需已安装运行时)

环境变量说明: 需在容器创建时设置 nvidia 运行时所需变量,可通过 Dockerfile 的 ENV、docker-compose.yml 的 environment 或 docker run -e 实现。NVIDIA_VISIBLE_DEVICES 为必需项,建议设为 all。

示例:

dockerfile
# syntax=docker/dockerfile:1.4
FROM docker.xuanyuan.run/vsiri/recipe:cuda as cuda

FROM docker.xuanyuan.run/redhat/ubi8
COPY --from=cuda /usr/local /usr/local
# 所有 recipes 通用补丁命令(只需运行一次)
RUN shopt -s nullglob; for patch in /usr/local/share/just/container_build_patch/*; do "${patch}"; done
# 必需环境变量
ENV NVIDIA_VISIBLE_DEVICES=all
# 可选环境变量(默认值为 compute,utility)
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility

# 构建源码时加载 CUDA 环境变量
RUN source /usr/local/share/just/user_run_patch/10_load_cuda_env; \
    cmake .  # 示例命令

CUDA GL

名称CUDA GL
构建参数CUDA_RECIPE_TARGET - 指定安装的 CUDA 组件(同 CUDA recipe,默认:runtime)
LIBGLVND_VERSION - GLVND 版本(默认:v1.7.0)
环境变量NVIDIA_DRIVER_CAPABILITIES - 需包含 graphics(如 graphics,compute,utility)
输出目录/usr/local
最低 Dockerfile 前端docker/dockerfile:1.3-labs 或 docker/dockerfile:1.4

扩展 CUDA recipe,添加 OpenGL 支持。CUDA_RECIPE_TARGET=devel-only 会同时安装运行时和开发包。

示例:

dockerfile
# syntax=docker/dockerfile:1.4
FROM docker.xuanyuan.run/vsiri/recipe:cudagl as cudagl

FROM docker.xuanyuan.run/redhat/ubi8
COPY --from=cudagl /usr/local /usr/local
# 所有 recipes 通用补丁命令(只需运行一次)
RUN shopt -s nullglob; for patch in /usr/local/share/just/container_build_patch/*; do "${patch}"; done

ENV NVIDIA_DRIVER_CAPABILITIES=graphics,compute,utility

Amanda debian packages

名称Amanda
构建参数AMANDA_VERSION - 要构建的分支名称(可为 SHA)
输出文件/amanda-backup-client_${AMANDA_VERSION}-1Debian82_amd64.deb
/amanda-backup-server_${AMANDA_VERSION}-1Debian82_amd64.deb

用于构建 Amanda 磁带备份软件的 Debian 包。

One True Awk

名称One True Awk
构建参数ONETRUEAWK_VERSION - 要下载的 one true awk 版本
输出目录/usr/local

https://github.com/onetrueawk/awk 是简化版 awk,用于测试兼容性。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:onetrueawk as onetrueawk
FROM docker.xuanyuan.run/debian:9
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=onetrueawk /usr/local /usr/local

Conda's python

名称Python
构建参数USE_MINICONDA - 设为 1 时使用 miniconda 而非 miniforge
PYTHON_VERSION - 要下载的 Python 版本
PYTHON_INSTALL_DIR - Python 安装路径(需保持绝对路径不变)
输出目录/usr/local

通过 miniforge(或 miniconda)安装独立 Python 环境,适用于在任意 Linux 发行版上安装指定 Python 版本。

示例:

dockerfile
FROM docker.xuanyuan.run/vsiri/recipe:conda-python as python
FROM docker.xuanyuan.run/ubuntu:16.04
RUN apt-get update; apt-get install -y vim  # 示例命令
COPY --from=python /usr/local /usr/local

PROJ-data

名称PROJ-data
构建参数PROJ_DATA_VERSION - 要下载的 proj-data 版本
输出目录/usr/local

安装 [PROJ-data](https://github.com/OSGeo/PROJ

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 recipe 镜像标签

docker pull docker.xuanyuan.run/vsiri/recipe:<标签>

DockerHub 原生拉取命令

docker pull vsiri/recipe:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告