$npx -y skills add github/awesome-copilot --skill containerize-aspnetcoreContainerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project.
| 1 | # ASP.NET Core Docker Containerization Prompt |
| 2 | |
| 3 | ## Containerization Request |
| 4 | |
| 5 | Containerize the ASP.NET Core (.NET) project specified in the settings below, focusing **exclusively** on changes required for the application to run in a Linux Docker container. Containerization should consider all settings specified here. |
| 6 | |
| 7 | Abide by best practices for containerizing .NET Core applications, ensuring that the container is optimized for performance, security, and maintainability. |
| 8 | |
| 9 | ## Containerization Settings |
| 10 | |
| 11 | This section of the prompt contains the specific settings and configurations required for containerizing the ASP.NET Core application. Prior to running this prompt, ensure that the settings are filled out with the necessary information. Note that in many cases, only the first few settings are required. Later settings can be left as defaults if they do not apply to the project being containerized. |
| 12 | |
| 13 | Any settings that are not specified will be set to default values. The default values are provided in `[square brackets]`. |
| 14 | |
| 15 | ### Basic Project Information |
| 16 | 1. Project to containerize: |
| 17 | - `[ProjectName (provide path to .csproj file)]` |
| 18 | |
| 19 | 2. .NET version to use: |
| 20 | - `[8.0 or 9.0 (Default 8.0)]` |
| 21 | |
| 22 | 3. Linux distribution to use: |
| 23 | - `[debian, alpine, ubuntu, chiseled, or Azure Linux (mariner) (Default debian)]` |
| 24 | |
| 25 | 4. Custom base image for the build stage of the Docker image ("None" to use standard Microsoft base image): |
| 26 | - `[Specify base image to use for build stage (Default None)]` |
| 27 | |
| 28 | 5. Custom base image for the run stage of the Docker image ("None" to use standard Microsoft base image): |
| 29 | - `[Specify base image to use for run stage (Default None)]` |
| 30 | |
| 31 | ### Container Configuration |
| 32 | 1. Ports that must be exposed in the container image: |
| 33 | - Primary HTTP port: `[e.g., 8080]` |
| 34 | - Additional ports: `[List any additional ports, or "None"]` |
| 35 | |
| 36 | 2. User account the container should run as: |
| 37 | - `[User account, or default to "$APP_UID"]` |
| 38 | |
| 39 | 3. Application URL configuration: |
| 40 | - `[Specify ASPNETCORE_URLS, or default to "http://+:8080"]` |
| 41 | |
| 42 | ### Build configuration |
| 43 | 1. Custom build steps that must be performed before building the container image: |
| 44 | - `[List any specific build steps, or "None"]` |
| 45 | |
| 46 | 2. Custom build steps that must be performed after building the container image: |
| 47 | - `[List any specific build steps, or "None"]` |
| 48 | |
| 49 | 3. NuGet package sources that must be configured: |
| 50 | - `[List any private NuGet feeds with authentication details, or "None"]` |
| 51 | |
| 52 | ### Dependencies |
| 53 | 1. System packages that must be installed in the container image: |
| 54 | - `[Package names for the chosen Linux distribution, or "None"]` |
| 55 | |
| 56 | 2. Native libraries that must be copied to the container image: |
| 57 | - `[Library names and paths, or "None"]` |
| 58 | |
| 59 | 3. Additional .NET tools that must be installed: |
| 60 | - `[Tool names and versions, or "None"]` |
| 61 | |
| 62 | ### System Configuration |
| 63 | 1. Environment variables that must be set in the container image: |
| 64 | - `[Variable names and values, or "Use defaults"]` |
| 65 | |
| 66 | ### File System |
| 67 | 1. Files/directories that need to be copied to the container image: |
| 68 | - `[Paths relative to project root, or "None"]` |
| 69 | - Target location in container: `[Container paths, or "Not applicable"]` |
| 70 | |
| 71 | 2. Files/directories to exclude from containerization: |
| 72 | - `[Paths to exclude, or "None"]` |
| 73 | |
| 74 | 3. Volume mount points that should be configured: |
| 75 | - `[Volume paths for persistent data, or "None"]` |
| 76 | |
| 77 | ### .dockerignore Configuration |
| 78 | 1. Patterns to include in the `.dockerignore` file (.dockerignore will already have common defaults; these are additional patterns): |
| 79 | - Additional patterns: `[List any additional patterns, or "None"]` |
| 80 | |
| 81 | ### Health Check Configuration |
| 82 | 1. Health check endpoint: |
| 83 | - `[Health check URL path, or "None"]` |
| 84 | |
| 85 | 2. Health check interval and timeout: |
| 86 | - `[Interval and timeout values, or "Use defaults"]` |
| 87 | |
| 88 | ### Additional Instructions |
| 89 | 1. Other instructions that must be followed to containerize the project: |
| 90 | - `[Specific requirements, or "None"]` |
| 91 | |
| 92 | 2. Known issues to address: |
| 93 | - `[Describe any known issues, or "None"]` |
| 94 | |
| 95 | ## Scope |
| 96 | |
| 97 | - ✅ App configuration modification to ensure application settings and connection strings can be read from environment variables |
| 98 | - ✅ Dockerfile creation and configuration for an ASP.NET Core application |
| 99 | - ✅ Specifying multiple stages in the Dockerfile to build/publish the application and copy the output to the final image |
| 100 | - ✅ Configuration of Linux container platform compatibility (Alpine, Ubuntu, Chiseled, or Azure Linux (Mariner)) |
| 101 | - ✅ Proper handling of dependencies (system packages, native libraries, additional tools) |
| 102 | - ❌ No infrastructure setup (assumed to be handled separately) |
| 103 | - ❌ No code changes beyond those required for containerization |
| 104 | |
| 105 | ## Execution Process |
| 106 | |
| 107 | 1. Review the containerization settings above to understand the containerization requirements |
| 108 | 2. Create a `progress.md` file to t |