📎 Webclip
Deploying a asp.net core container with Zeit "now"
The post walks through deploying a sample ASP.NET Core Web API with Zeit now. It starts from a fresh dotnet new webapi project, adds a Dockerfile and .dockerignore, installs the now CLI with npm, and deploys by running now.
It also describes a free-plan limitation in which files in the container build context cannot exceed 1 MB, which blocks a compiled-runtime approach. The author lists three workarounds: use the build image, remove the large files, or build and push an image to a registry before deploying. The post ends by recommending now for its simplicity while noting interest in how its web-app-focused constraints affect real projects.
Reading notes#
- Create a sample Web API with
dotnet new webapi, confirm it runs locally, and expose the default/api/valuesendpoint. - Use a Dockerfile based on
microsoft/aspnetcore-build, expose port 80, copy the source into the container, restore dependencies, and run the app. - Add
.dockerignoresobinandobjstay out of the build context. - The free plan has a 1 MB limit for individual files in the build context, which makes a compiled runtime-image approach fail for this project.
- The post lists three ways around that limit: use the build image, remove large runtime-irrelevant files, or build and push an image to a registry first.
- Install now with
npm install -g nowand deploy by runningnow, then follow the prompts and email registration if needed. - Each deployment gets a new URL, and aliases or custom domains can point to chosen deployments.
- The author recommends now despite the file-size restriction and wants to test how its web-app-only model fits future projects.
