Scripts2026年7月6日·1 分钟阅读

Nixpacks — Build Docker Images from App Source with Zero Config

Nixpacks takes application source code and produces an OCI container image automatically by detecting the language, installing dependencies, and configuring the build — no Dockerfile required.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Nixpacks Overview
先审查命令
npx -y tokrepo@latest install 144dfd67-78d1-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

Nixpacks turns application source code into OCI container images without requiring a Dockerfile. It inspects your project, detects the language and framework, resolves dependencies with Nix, and builds a production-ready image. It was created by Railway for their deployment platform and is open-sourced for general use.

What Nixpacks Does

  • Auto-detects language and framework from project files
  • Installs system dependencies using Nix for reproducibility
  • Generates optimized multi-phase Docker builds
  • Supports Node.js, Python, Go, Rust, Java, Ruby, PHP, and more
  • Produces lean production images without build-time bloat

Architecture Overview

Nixpacks runs in three phases: detect, plan, and build. The detect phase identifies the language from files like package.json or requirements.txt. The plan phase generates a build plan specifying Nix packages, install commands, and build commands. The build phase executes the plan inside a Docker build, producing a final image. Nix is used for system-level dependencies, ensuring builds are reproducible across machines.

Self-Hosting & Configuration

  • Install the CLI binary on macOS or Linux
  • Point it at any application directory to build an image
  • Override auto-detected settings with a nixpacks.toml file
  • Set custom build and start commands via CLI flags
  • Integrates with any container registry for image pushing

Key Features

  • True zero-config for most standard project structures
  • Nix-based dependency resolution for reproducible builds
  • Support for 15+ languages and frameworks out of the box
  • Customizable build plans when defaults need adjustment
  • Significantly faster than generic Dockerfile approaches for many projects

Comparison with Similar Tools

  • Dockerfile — manual, full control; Nixpacks automates the common case
  • Buildpacks (Paketo/Heroku) — similar auto-detect concept; Nixpacks uses Nix for deps and is often faster
  • Docker Init — generates a Dockerfile; Nixpacks skips the Dockerfile entirely
  • ko — Go-specific image builder; Nixpacks is polyglot

FAQ

Q: What languages does Nixpacks support? A: Node.js, Python, Go, Rust, Ruby, PHP, Java, .NET, Elixir, Haskell, Zig, and several others.

Q: Can I use it in CI/CD? A: Yes. The CLI runs in any CI environment with Docker available.

Q: How does it compare to a hand-written Dockerfile? A: For standard apps, Nixpacks produces comparable images with less effort. Complex multi-service builds may still need a custom Dockerfile.

Q: Does it require Nix to be installed? A: No. Nix runs inside the Docker build. Only Docker is required on the host.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产