Vercel で任意の Dockerfile を実行可能に
Vercel は、Dockerfile を使用して任意のバックエンドサービス(Go, Rails, Java など)を Fluid Compute プラットフォーム上で直接デプロイ・スケーリング可能にする新機能を発表した。
キーポイント
Dockerfile ベースのフルスタックデプロイ
Vercel は Frontend と同様に、任意の言語やフレームワークで書かれた Docker コンテナをネイティブにサポートし、Git push だけで自動ビルド・デプロイを実現する。
Fluid Compute とアクティブ CPU 課金
リソースの使用状況に基づき、アイドル状態でも CPU を消費しないよう自動的にスケーリングダウンし、実行時間のみに対して課金する新しいコンピューティングモデルを採用している。
高速起動と最適化されたブートイメージ
コンテナのディスクを圧縮スナップショットとして保存・ストリーミング展開することで、大規模なイメージでも即座にリクエストに応答可能な状態にする技術を実装した。
ステートレス設計と自動スケーリング
各コンテナはリクエストごとに状態を持たないステートレスプロセスであり、永続データは外部サービスに依存します。これにより、Vercel はトラフィックに応じてインスタンスを自動的に追加・削除できます。
フレームワーク検出と Dockerfile の役割
主要なフレームワークは自動検出でデプロイされますが、Dockerfile はシステムライブラリの依存や未対応のフレームワークを持つアプリのための「ユニバーサル」な手段として機能します。
ゼロ構成での完全管理
イメージを指定するだけで、ビルド、レジストリ、ロールアウト、スケーリング、URL 生成までが自動的に処理され、設定不要でバックエンドをフロントエンドと同じように扱えます。
影響分析・編集コメントを表示
影響分析
この発表は、Vercel が従来の静的サイトホスティングから、フルスタックのサーバーレスプラットフォームへと進化を示す重要な転換点です。開発者は複雑なインフラ管理を回避しつつ、既存の Docker エコシステムを活用して柔軟なバックエンド構築が可能となり、クラウドネイティブ開発の参入障壁がさらに低下します。
編集コメント
AI モデルのトレーニングや推論インフラとしての利用は想定されていませんが、LLM アプリケーションのバックエンド(API サーバー)を Vercel でホストするケースが増えることで、開発者のワークフローに大きな影響を与える可能性があります。
コンテナ内にサーバーがあります。Go サービス、Rails アプリ、Spring Boot API、あるいは nginx の背後にある Web サーバーかもしれません。HTTP を扱い、ポートをリッスンしています。ただ実行場所が必要なのです。
プロジェクトに Dockerfile.vercel ファイルを追加すると、Vercel が Fluid compute 上でイメージのビルド、保存、デプロイ、自動スケーリングを行います。そのため、コードが使用する CPU の分だけ支払いが発生します。ローカルで実行するデーモン、設定するレジストリ、世話を続けるクラスターは不要です。
仕組みについて
以下は $PORT でリッスンしている小さな Go 製の HTTP サーバーの例です:
これを小さなイメージにビルドして実行するための Dockerfile.vercel ファイルを追加します:
次にデプロイします:
これだけです。2 つのファイルで、すぐにライブになります。git push を行うたびにイメージが再ビルドされ、新しいプレビュー URL が提供されます。あるいは vercel コマンドを実行してコミットせずにデプロイすることも可能です。
この例では Go を使用しましたが、あらゆるスタックが動作します。Rails、Spring Boot、Express、Laravel、ASP.NET、FastAPI、そして nginx の背後にある Web サーバーもすべて同じ方法でデプロイされます。唯一のルールは、サーバーが $PORT でリッスンすることです(デフォルト値は 80 です)。HTTP を扱えば、デプロイ可能です。Java でも、PHP でも同様です。
得られるもの
Vercel 上のコンテナはファーストクラス・シチズンとして扱われます。フロントエンドや Vercel 上の他のサービスと同じプラットフォームおよび同じコンピューティングリソース上で動作します。
すべてのプッシュに対するプレビューデプロイメント:すべてのコミットに、開いて共有し、ロールバックも可能な一意の不変 URL が割り当てられます。
両方向への自動スケーリング:トラフィックが到着すればスケールアウトし、トラフィックが止まればインスタンスはシャットダウンします。ファームのサイズを事前に決めたり、並行処理数を推測したりする必要はありません。
アクティブ CPU 課金:コードが実際に実行されている時間に対して流体コンピューティングの請求が発生するため、アイドル状態のサーバーが、低速なクエリやアップストリームの API を待機している間に CPU を無駄に消費することはありません。実行時間に課金し、壁時計(経過)時間には課金しません。
観測性の標準装備:ログ、トレース、メトリクスは、あなたがデプロイする他のすべてのものと同じダッシュボード上に存在します。
1 プロジェクト 1 ドメイン:コンテナはフロントエンドやその他のサービスと共に配置され、Vercel ネットワークを介してプライベートに通信します。フルスタックが単一のデプロイとして出荷されます。
高速起動のために設計された
コンテナの良し悪しは、最初の要求に応答するまでの時間で決まります。
Vercel がイメージを構築する際、それは最適化されたブートイメージとして保存されます。これは高速な起動のために調整された、コンテナディスクの圧縮スナップショットです。
コンテナが起動すると、全体像をダウンロードしてから実行を開始するのではなく、そのスナップストリームをストリーミングし、必要な時にデコンプレッションを行います。サーバーは完全なイメージが揃う前にリクエストの処理を開始できるため、大きなイメージでも最初にダウンロード完了を待つ必要はありません。
一度インスタンスが稼働すると、Fluid compute がそれをウォーム状態に保ち、各要求ごとに新しいコピーを起動するのではなく、1 つのインスタンスから多数の要求に応答します。アイドル時にはスリープするサーバーの請求額で、ウォームサーバーのような応答性を得ることができます。
各コンテナはステートレスプロセスです:リクエストを受け取り、レスポンスを返し、その間に何も保持しません。永続的な状態は、データベースや Vercel マーケットプレイスからのキャッシュなど、接続するバックエンドサービスに存在します。インスタンスには生存する必要のあるデータが何もないため、Vercel はトラフィックが発生した際にインスタンスを追加し、トラフィックが止まるとそれらを廃棄できます。また、コンテナに接続される永続ストレージの提供も近日中に開始予定です。
なぜ今なのか?
私たちの最初のプラットフォームでは、単一のコマンドで Dockerfile をデプロイできました。それは 10 年前の話ですが、アイデア自体は正しくても、それを素晴らしいものにするためのインフラストラクチャはまだ存在していませんでした。
それ以来の数年間、私たちはこれを適切に処理するためのプリミティブ(基本構成要素)の開発に注力してきました。これらは Vercel で実行されるすべてのものを支えています:ビルド、関数、サンドボックス、そして今やコンテナです。すべてはトラフィックに合わせてスケールし、使用した CPU 分のみに対して課金されます。コンテナはもはやファーストクラス・シチズン(一等市民)となり、他のすべてのものと同じシステム上で実行されています。
フレームワークの検出が私たちのフロントドアです。あなたのフレームワークを認識すると、コードを読み取り、アプリに必要なインフラストラクチャを導き出します。なぜなら、コード自体が何を行うべきかをすでに記述しているからです。ほとんどのアプリにとって、これが最も迅速な配信方法です。Dockerfile はそれ以外のすべて向けです:FFmpeg や Chromium などのシステムライブラリが必要なサービスや、まだ自動検出していないフレームワーク、あるいは既存の動作をそのまま持ち込みたいアプリなどです。これはプログラムがどのように構築されるべきかを記述する普遍的な方法であり、読み込むべきフレームワークがない場合、私たちはそれを直接受け入れます。
Dockerfile の周囲はすべてゼロ構成です。イメージを指定するだけで、ビルド、レジストリ、ロールアウト、スケーリング、URL などがすべて自動的に実行されます。
バックエンドが復活しました
あなたのバックエンドも、フロントエンドと同じように、1 つのプッシュで、1 つのプレビュー環境で、1 つのプラットフォーム上で配信されるようになりました。あなたが何を作るか、今から楽しみです。
ドキュメントを読むか、例をデプロイして始めましょう。
もっと読む
原文を表示
You have a server in a container. Maybe it's a Go service, a Rails app, a Spring Boot API, or a web server behind nginx. It speaks HTTP. It listens on a port. It just needs somewhere to run.
Add a Dockerfile.vercel file to your project, and Vercel builds, stores, deploys, and autoscales the image on Fluid compute, so you pay only for the CPU your code uses. No daemon to run locally, registry to set up, or cluster to babysit.
How it works
Here is a small HTTP server in Go, listening on $PORT:
Add a Dockerfile.vercel file that builds it into a small image and runs it:
Then deploy:
That is it. Two files, and you are live. Every git push rebuilds the image and hands you a fresh preview URL. Or run vercel to deploy without committing.
We used Go in this example, but any stack works. Rails, Spring Boot, Express, Laravel, ASP.NET, FastAPI, and a web server behind nginx all deploy the same way. The only rule is that your server listens on $PORT, which defaults to 80. If it speaks HTTP, it deploys. Yes, even Java. And yes, even PHP.
What you get
A container on Vercel is a first-class citizen. It runs on the same platform, and the same compute, as your frontend and the rest of your services on Vercel.
A preview deployment for every push: Every commit gets its own immutable URL you can open, share, and roll back to.
Autoscaling, in both directions: Traffic arrives and you scale out. Traffic stops and your instances wind down. You never size a fleet or guess a concurrency number.
Active CPU pricing: Fluid compute bills for the time your code is actually running, so an idle server, parked on a slow query or an upstream API, isn't burning CPU while it waits. You pay for execution time, not wall time.
Observability, included: Logs, traces, and metrics for your container live in the same dashboard as everything else you ship.
One project, one domain: Your container sits beside your frontend and your other services and talks to them privately over the Vercel network. Your full stack ships as one deploy.
Built to start fast
A container is only as good as the time it takes to answer it's first request.
When Vercel builds your image, it stores it as an optimized boot image, a compressed snapshot of the container's disk tuned for fast startup.
When a container boots, we stream that snapshot and decompress it on demand, rather than downloading the whole image before anything runs. Your server can start handling requests before the full image is in place, so a larger image does not have to finish downloading first.
Once an instance is running, Fluid compute keeps it warm and serves many requests from it, rather than starting a fresh copy for each one. You get the responsiveness of a warm server and the bill of one that sleeps when idle.
Each container is a stateless process: it takes a request, returns a response, and keeps nothing in between. Persistent state lives in a backing service you attach, like a database or cache from the Vercel Marketplace. Because an instance holds nothing that has to survive, Vercel can add instances when traffic arrives and retire them when it stops. We're also working on shipping durable storage attached to containers soon.
Why now?
Our first platform let you deploy a Dockerfile with a single command. That was a decade ago, and the idea was right, but the infrastructure to make it great didn't exist yet.
We've spent the years since building the primitives to handle it well. They power everything you run on Vercel: Builds, Functions, Sandboxes, and now containers. It all scales with traffic, and you only pay for the CPU you use. A container is now a first-class citizen, running on the same system as everything else.
Framework detection is our front door. When we recognize your framework, we read your code and derive the infrastructure your app needs, because the code already describes what it should do. For most apps it's the fastest way to ship. A Dockerfile is for everything else: a service that needs a system library like FFmpeg or Chromium, a framework we do not auto-detect yet, or an app you want to bring exactly as it already runs. It is the universal way to say how a program should be built, so when there is no framework to read, we meet it directly.
Everything around your Dockerfile is zero configuration. You point at the image, and the build, the registry, the rollout, the scaling, and the URL all just happen.
Backends are back
Your backend now ships the way your frontend does: one push, one preview, one platform. We can't wait to see what you build.
Read the docs or deploy an example to get started.
Read more
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み