跳到正文
Vercel Blog(vercel.com)· Jeff See·· 1 天前精選AI 評分73

Vercel 現已支援直接部署純 Dockerfile 容器

Deploy a container from a plain Dockerfile

AI 導讀

Vercel 現已支援直接部署純 Dockerfile 或 Containerfile,使用 Container 執行時環境。

  • 部署方式:在專案根目錄放置 Dockerfile 或 Containerfile,Vercel 自動選擇 Container preset 並建構映像。
推薦理由

Vercel 現已支援直接部署純 Dockerfile,簡化容器化流程,提升開發效率。

正文 · 原文

You can now deploy a plain root Dockerfile or Containerfile on Vercel's Container runtime when no other framework is detected. Vercel selects the Container preset, builds that file, and routes all traffic to the resulting image. To get started with containers on Vercel, add a Dockerfile:

Dockerfile

FROM node:26-alpine

RUN npm i -g srvx

COPY . /app

WORKDIR /app

EXPOSE 3000

CMD ["srvx", "--port", "3000"]

When project detection matches another framework, such as Django, that framework still wins. To build use the Dockerfile or Containerfile instead, run vercel project update --framework container, or set the framework in vercel.json:

vercel.json

{

"framework": "container"

}

A Dockerfile.vercel or Containerfile.vercel continues to win over a detected framework, and multi-service projects still use vercel.json services with a per-service entrypoint.

The Container runtime is in beta, runs on Vercel Functions, and is billed with Active CPU pricing. Read the Container runtime documentation to get started.

來源: Vercel Blog (vercel.com)
開啟原文