-
Notifications
You must be signed in to change notification settings - Fork 3
๐ Implement comprehensive deployment and containerization strategy #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Docker ignore file for NLWebNet | ||
| # Optimizes Docker build context by excluding unnecessary files | ||
|
|
||
| # Git | ||
| .git | ||
| .gitignore | ||
| .gitattributes | ||
|
|
||
| # GitHub workflows and metadata | ||
| .github/ | ||
| copilot-setup-steps.yml | ||
|
|
||
| # IDE and editor files | ||
| .vs/ | ||
| .vscode/ | ||
| *.user | ||
| *.suo | ||
| *.userosscache | ||
| *.sln.docstates | ||
| .idea/ | ||
|
|
||
| # Build outputs | ||
| **/bin/ | ||
| **/obj/ | ||
| **/out/ | ||
| **/.vs/ | ||
|
|
||
| # Test results | ||
| TestResults/ | ||
| test-results*.xml | ||
| coverage*.xml | ||
| *.coverage | ||
| *.coveragexml | ||
|
|
||
| # NuGet | ||
| packages/ | ||
| *.nupkg | ||
| *.snupkg | ||
| **/packages/* | ||
| !**/packages/build/ | ||
|
|
||
| # Runtime logs | ||
| logs/ | ||
| *.log | ||
|
|
||
| # OS generated files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Temporary files | ||
| tmp/ | ||
| temp/ | ||
| *.tmp | ||
| *.temp | ||
|
|
||
| # Documentation (not needed in container) | ||
| README.md | ||
| doc/ | ||
| *.md | ||
|
|
||
| # Scripts (not needed in runtime) | ||
| scripts/ | ||
|
|
||
| # License files | ||
| LICENSE* | ||
| COPYING* | ||
|
|
||
| # Docker files (avoid recursion) | ||
| Dockerfile* | ||
| docker-compose* | ||
| .dockerignore | ||
|
|
||
| # Environment specific files (use volume mounts instead) | ||
| appsettings.*.json | ||
| !appsettings.json | ||
| *.env | ||
| .env* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Multi-stage Dockerfile for NLWebNet Demo Application | ||
| # Based on .NET 9 runtime and optimized for production deployment | ||
|
|
||
| # Build stage | ||
| FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build | ||
| WORKDIR /src | ||
|
|
||
| # Copy solution file and project files for dependency resolution | ||
| COPY ["NLWebNet.sln", "./"] | ||
| COPY ["src/NLWebNet/NLWebNet.csproj", "src/NLWebNet/"] | ||
| COPY ["samples/Demo/NLWebNet.Demo.csproj", "samples/Demo/"] | ||
| COPY ["samples/AspireHost/NLWebNet.AspireHost.csproj", "samples/AspireHost/"] | ||
| COPY ["tests/NLWebNet.Tests/NLWebNet.Tests.csproj", "tests/NLWebNet.Tests/"] | ||
|
|
||
| # Restore dependencies | ||
| RUN dotnet restore "samples/Demo/NLWebNet.Demo.csproj" | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # Build the demo application | ||
| WORKDIR "/src/samples/Demo" | ||
| RUN dotnet build "NLWebNet.Demo.csproj" -c Release -o /app/build | ||
|
|
||
| # Publish stage | ||
| FROM build AS publish | ||
| RUN dotnet publish "NLWebNet.Demo.csproj" -c Release -o /app/publish /p:UseAppHost=false | ||
|
|
||
| # Runtime stage | ||
| FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final | ||
|
|
||
| # Create a non-root user for security | ||
| RUN groupadd -r nlwebnet && useradd -r -g nlwebnet nlwebnet | ||
|
|
||
| # Set working directory | ||
| WORKDIR /app | ||
|
|
||
| # Copy published application | ||
| COPY --from=publish /app/publish . | ||
|
|
||
| # Create directory for logs and ensure proper permissions | ||
| RUN mkdir -p /app/logs && chown -R nlwebnet:nlwebnet /app | ||
|
|
||
| # Switch to non-root user | ||
| USER nlwebnet | ||
|
|
||
| # Configure ASP.NET Core | ||
| ENV ASPNETCORE_ENVIRONMENT=Production | ||
| ENV ASPNETCORE_URLS=http://+:8080 | ||
| ENV ASPNETCORE_HTTP_PORTS=8080 | ||
|
|
||
| # Expose port | ||
| EXPOSE 8080 | ||
|
|
||
| # Health check | ||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | ||
| CMD curl -f http://localhost:8080/health || exit 1 | ||
|
|
||
| # Entry point | ||
| ENTRYPOINT ["dotnet", "NLWebNet.Demo.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider increasing the sleep duration before testing the health endpoint to accommodate slower container startup times in some environments.