Combine containerization settings into containerization prompt
This commit is contained in:
parent
958cae249d
commit
8053d25c58
@ -8,10 +8,96 @@ description: 'Containerize an ASP.NET Core project by creating Dockerfile and .d
|
||||
|
||||
## Containerization Request
|
||||
|
||||
Containerize the ASP.NET Core (.NET) project specified in the [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) settings file, focusing **exclusively** on changes required for the application to run in a Linux Docker container. Containerization should consider all settings specified in the [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) file.
|
||||
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.
|
||||
|
||||
Abide by best practices for containerizing .NET Core applications, ensuring that the container is optimized for performance, security, and maintainability.
|
||||
|
||||
## Containerization Settings
|
||||
|
||||
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.
|
||||
|
||||
Any settings that are not specified will be set to default values. The default values are provided in `[square brackets]`.
|
||||
|
||||
### Basic Project Information
|
||||
1. Project to containerize:
|
||||
- `[ProjectName (provide path to .csproj file)]`
|
||||
|
||||
2. .NET version to use:
|
||||
- `[8.0 or 9.0 (Default 8.0)]`
|
||||
|
||||
3. Linux distribution to use:
|
||||
- `[debian, alpine, ubuntu, chiseled, or Azure Linux (mariner) (Default debian)]`
|
||||
|
||||
4. Custom base image for the build stage of the Docker image ("None" to use standard Microsoft base image):
|
||||
- `[Specify base image to use for build stage (Default None)]`
|
||||
|
||||
5. Custom base image for the run stage of the Docker image ("None" to use standard Microsoft base image):
|
||||
- `[Specify base image to use for run stage (Default None)]`
|
||||
|
||||
### Container Configuration
|
||||
1. Ports that must be exposed in the container image:
|
||||
- Primary HTTP port: `[e.g., 8080]`
|
||||
- Additional ports: `[List any additional ports, or "None"]`
|
||||
|
||||
2. User account the container should run as:
|
||||
- `[User account, or default to "$APP_UID"]`
|
||||
|
||||
3. Application URL configuration:
|
||||
- `[Specify ASPNETCORE_URLS, or default to "http://+:8080"]`
|
||||
|
||||
### Build configuration
|
||||
1. Custom build steps that must be performed before building the container image:
|
||||
- `[List any specific build steps, or "None"]`
|
||||
|
||||
2. Custom build steps that must be performed after building the container image:
|
||||
- `[List any specific build steps, or "None"]`
|
||||
|
||||
3. NuGet package sources that must be configured:
|
||||
- `[List any private NuGet feeds with authentication details, or "None"]`
|
||||
|
||||
### Dependencies
|
||||
1. System packages that must be installed in the container image:
|
||||
- `[Package names for the chosen Linux distribution, or "None"]`
|
||||
|
||||
2. Native libraries that must be copied to the container image:
|
||||
- `[Library names and paths, or "None"]`
|
||||
|
||||
3. Additional .NET tools that must be installed:
|
||||
- `[Tool names and versions, or "None"]`
|
||||
|
||||
### System Configuration
|
||||
1. Environment variables that must be set in the container image:
|
||||
- `[Variable names and values, or "Use defaults"]`
|
||||
|
||||
### File System
|
||||
1. Files/directories that need to be copied to the container image:
|
||||
- `[Paths relative to project root, or "None"]`
|
||||
- Target location in container: `[Container paths, or "Not applicable"]`
|
||||
|
||||
2. Files/directories to exclude from containerization:
|
||||
- `[Paths to exclude, or "None"]`
|
||||
|
||||
3. Volume mount points that should be configured:
|
||||
- `[Volume paths for persistent data, or "None"]`
|
||||
|
||||
### .dockerignore Configuration
|
||||
1. Patterns to include in the `.dockerignore` file (.dockerignore will already have common defaults; these are additional patterns):
|
||||
- Additional patterns: `[List any additional patterns, or "None"]`
|
||||
|
||||
### Health Check Configuration
|
||||
1. Health check endpoint:
|
||||
- `[Health check URL path, or "None"]`
|
||||
|
||||
2. Health check interval and timeout:
|
||||
- `[Interval and timeout values, or "Use defaults"]`
|
||||
|
||||
### Additional Instructions
|
||||
1. Other instructions that must be followed to containerize the project:
|
||||
- `[Specific requirements, or "None"]`
|
||||
|
||||
2. Known issues to address:
|
||||
- `[Describe any known issues, or "None"]`
|
||||
|
||||
## Scope
|
||||
|
||||
- ✅ App configuration modification to ensure application settings and connection strings can be read from environment variables
|
||||
@ -24,13 +110,13 @@ Abide by best practices for containerizing .NET Core applications, ensuring that
|
||||
|
||||
## Execution Process
|
||||
|
||||
1. Review the [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) file to understand the containerization requirements
|
||||
1. Review the containerization settings above to understand the containerization requirements
|
||||
2. Create a `progress.md` file to track changes with check marks
|
||||
3. Determine the .NET version from the project's .csproj file by checking the `TargetFramework` element
|
||||
4. Select the appropriate Linux container image based on:
|
||||
- The .NET version detected from the project
|
||||
- The Linux distribution specified in [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) (Alpine, Ubuntu, Chiseled, or Azure Linux (Mariner))
|
||||
- If the user does not request specific base images in the settings file, then the base images MUST be valid mcr.microsoft.com/dotnet images with a tag as shown in the example Dockerfile, below, or in documentation
|
||||
- The Linux distribution specified in containerization settings (Alpine, Ubuntu, Chiseled, or Azure Linux (Mariner))
|
||||
- If the user does not request specific base images in the containerization settings, then the base images MUST be valid mcr.microsoft.com/dotnet images with a tag as shown in the example Dockerfile, below, or in documentation
|
||||
- Official Microsoft .NET images for build and runtime stages:
|
||||
- SDK image tags (for build stage): https://github.com/dotnet/dotnet-docker/blob/main/README.sdk.md
|
||||
- ASP.NET Core runtime image tags: https://github.com/dotnet/dotnet-docker/blob/main/README.aspnet.md
|
||||
@ -45,9 +131,9 @@ Abide by best practices for containerizing .NET Core applications, ensuring that
|
||||
- Final stage: Use the selected .NET runtime image to run the application
|
||||
- Set the working directory to /app
|
||||
- Set the user as directed (by default, to a non-root user (e.g., `$APP_UID`))
|
||||
- Unless directed otherwise in [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md), a new user does *not* need to be created. Use the `$APP_UID` variable to specify the user account.
|
||||
- Unless directed otherwise in containerization settings, a new user does *not* need to be created. Use the `$APP_UID` variable to specify the user account.
|
||||
- Copy the published output from the build stage to the final image
|
||||
- Be sure to consider all requirements in the [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) file:
|
||||
- Be sure to consider all requirements in the containerization settings:
|
||||
- .NET version and Linux distribution
|
||||
- Exposed ports
|
||||
- User account for container
|
||||
@ -59,7 +145,7 @@ Abide by best practices for containerizing .NET Core applications, ensuring that
|
||||
- File/directory copying
|
||||
- Volume mount points
|
||||
- Health check configuration
|
||||
6. Create a `.dockerignore` file in the root of the project directory to exclude unnecessary files from the Docker image. The `.dockerignore` file **MUST** include at least the following elements as well as additional patterns as specified in the [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) file:
|
||||
6. Create a `.dockerignore` file in the root of the project directory to exclude unnecessary files from the Docker image. The `.dockerignore` file **MUST** include at least the following elements as well as additional patterns as specified in the containerization settings:
|
||||
- bin/
|
||||
- obj/
|
||||
- .dockerignore
|
||||
@ -73,8 +159,8 @@ Abide by best practices for containerizing .NET Core applications, ensuring that
|
||||
- *.suo
|
||||
- **/.DS_Store
|
||||
- **/Thumbs.db
|
||||
- Any additional patterns specified in the [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md) file
|
||||
7. Configure health checks if specified in the settings:
|
||||
- Any additional patterns specified in the containerization settings
|
||||
7. Configure health checks if specified in the containerization settings:
|
||||
- Add HEALTHCHECK instruction to Dockerfile if health check endpoint is provided
|
||||
- Use curl or wget to check the health endpoint
|
||||
8. Mark tasks as completed: [ ] → [✓]
|
||||
@ -246,7 +332,7 @@ ENTRYPOINT ["dotnet", "YourProject.dll"]
|
||||
|
||||
## Adapting this Example
|
||||
|
||||
**Note:** Customize this template based on the specific requirements in [`containerize-aspnetcore.settings.md`](containerize-aspnetcore.settings.md).
|
||||
**Note:** Customize this template based on the specific requirements in containerization settings.
|
||||
|
||||
When adapting this example Dockerfile:
|
||||
|
||||
|
||||
@ -1,87 +0,0 @@
|
||||
# Containerization Setting
|
||||
|
||||
This settings file is referenced from the prompt [`containerize-aspnetcore.prompt.md`](containerize-aspnetcore.prompt.md) and is used to configure the containerization of an ASP.NET Core application. It provides a structured way to specify settings required for building the Docker image.
|
||||
|
||||
Users should fill in the placeholders in this file prior to running the containerization prompt. 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.
|
||||
|
||||
Any settings that are not specified will be set to default values. The default values are provided in `[square brackets]`.
|
||||
|
||||
## Basic Project Information
|
||||
1. Project to containerize:
|
||||
- `[ProjectName (provide path to .csproj file)]`
|
||||
|
||||
2. .NET version to use:
|
||||
- `[8.0 or 9.0 (Default 8.0)]`
|
||||
|
||||
3. Linux distribution to use:
|
||||
- `[debian, alpine, ubuntu, chiseled, or Azure Linux (mariner) (Default debian)]`
|
||||
|
||||
4. Custom base image for the build stage of the Docker image ("None" to use standard Microsoft base image):
|
||||
- `[Specify base image to use for build stage (Default None)]`
|
||||
|
||||
5. Custom base image for the run stage of the Docker image ("None" to use standard Microsoft base image):
|
||||
- `[Specify base image to use for run stage (Default None)]`
|
||||
|
||||
## Container Configuration
|
||||
1. Ports that must be exposed in the container image:
|
||||
- Primary HTTP port: `[e.g., 8080]`
|
||||
- Additional ports: `[List any additional ports, or "None"]`
|
||||
|
||||
2. User account the container should run as:
|
||||
- `[User account, or default to "$APP_UID"]`
|
||||
|
||||
3. Application URL configuration:
|
||||
- `[Specify ASPNETCORE_URLS, or default to "http://+:8080"]`
|
||||
|
||||
## Build configuration
|
||||
1. Custom build steps that must be performed before building the container image:
|
||||
- `[List any specific build steps, or "None"]`
|
||||
|
||||
2. Custom build steps that must be performed after building the container image:
|
||||
- `[List any specific build steps, or "None"]`
|
||||
|
||||
3. NuGet package sources that must be configured:
|
||||
- `[List any private NuGet feeds with authentication details, or "None"]`
|
||||
|
||||
## Dependencies
|
||||
1. System packages that must be installed in the container image:
|
||||
- `[Package names for the chosen Linux distribution, or "None"]`
|
||||
|
||||
2. Native libraries that must be copied to the container image:
|
||||
- `[Library names and paths, or "None"]`
|
||||
|
||||
3. Additional .NET tools that must be installed:
|
||||
- `[Tool names and versions, or "None"]`
|
||||
|
||||
## System Configuration
|
||||
1. Environment variables that must be set in the container image:
|
||||
- `[Variable names and values, or "Use defaults"]`
|
||||
|
||||
## File System
|
||||
1. Files/directories that need to be copied to the container image:
|
||||
- `[Paths relative to project root, or "None"]`
|
||||
- Target location in container: `[Container paths, or "Not applicable"]`
|
||||
|
||||
2. Files/directories to exclude from containerization:
|
||||
- `[Paths to exclude, or "None"]`
|
||||
|
||||
3. Volume mount points that should be configured:
|
||||
- `[Volume paths for persistent data, or "None"]`
|
||||
|
||||
## .dockerignore Configuration
|
||||
1. Patterns to include in the `.dockerignore` file (.dockerignore will already have common defaults; these are additional patterns):
|
||||
- Additional patterns: `[List any additional patterns, or "None"]`
|
||||
|
||||
## Health Check Configuration
|
||||
1. Health check endpoint:
|
||||
- `[Health check URL path, or "None"]`
|
||||
|
||||
2. Health check interval and timeout:
|
||||
- `[Interval and timeout values, or "Use defaults"]`
|
||||
|
||||
## Additional Instructions
|
||||
1. Other instructions that must be followed to containerize the project:
|
||||
- `[Specific requirements, or "None"]`
|
||||
|
||||
2. Known issues to address:
|
||||
- `[Describe any known issues, or "None"]`
|
||||
Loading…
x
Reference in New Issue
Block a user