Dockerfile: run container process as non-root user (UID 10001) #257
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
| name: Build and Test Pull Requests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: "Build and Test Pull Requests" | |
| env: | |
| ASPNETCORE_ENVIRONMENT: "Production" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2.3.4 | |
| - name: Echo vars | |
| run: | | |
| echo "CI is > ${CI}" | |
| echo "HOME is > ${HOME}" | |
| - name: Restore Nuget Packages | |
| run: dotnet restore FileProcessor.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} | |
| - name: Build Code | |
| run: dotnet build FileProcessor.sln --configuration Release | |
| - name: Run Unit Tests | |
| run: | | |
| echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}" | |
| dotnet test "FileProcessor.BusinessLogic.Tests\FileProcessor.BusinessLogic.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=businesslogic-test-results.trx" | |
| dotnet test "FileProcessor.FileAggregate.Tests\FileProcessor.FileAggregate.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=fileaggregate-test-results.trx" | |
| dotnet test "FileProcessor.FileImportLogAggregate.Tests\FileProcessor.FileImportLogAggregate.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=fileimportlogaggregate-test-results.trx" | |
| - name: Build Docker Image | |
| run: docker build . --file FileProcessor/Dockerfile --tag fileprocessor:latest | |
| - name: Run Integration Tests | |
| run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=PRTest --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=integration-test-results.trx" | |
| - uses: actions/upload-artifact@v4.4.0 | |
| if: ${{ failure() }} | |
| with: | |
| name: tracelogs | |
| path: /home/txnproc/trace/ | |
| - name: Publish test results | |
| uses: dorny/test-reporter@v1 | |
| if: always() | |
| with: | |
| name: Unit Test Results | |
| path: '**/TestResults/*.trx' | |
| reporter: dotnet-trx | |
| fail-on-error: true | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: '**/TestResults/*.trx' | |
| retention-days: 30 |