mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Add docker run of repository tests
This commit is contained in:
@@ -63,21 +63,35 @@ services:
|
|||||||
image: api.specs
|
image: api.specs
|
||||||
container_name: test-env-api-specs
|
container_name: test-env-api-specs
|
||||||
depends_on:
|
depends_on:
|
||||||
sqlserver:
|
database.seed:
|
||||||
condition: service_healthy
|
condition: service_completed_successfully
|
||||||
database.migrations:
|
|
||||||
condition: service_completed_successfully
|
|
||||||
database.seed:
|
|
||||||
condition: service_completed_successfully
|
|
||||||
build:
|
build:
|
||||||
context: ./src/Core
|
context: ./src/Core
|
||||||
dockerfile: API/API.Specs/Dockerfile
|
dockerfile: API/API.Specs/Dockerfile
|
||||||
args:
|
args:
|
||||||
BUILD_CONFIGURATION: Release
|
BUILD_CONFIGURATION: Release
|
||||||
environment:
|
environment:
|
||||||
ASPNETCORE_ENVIRONMENT: "Test"
|
|
||||||
DOTNET_RUNNING_IN_CONTAINER: "true"
|
DOTNET_RUNNING_IN_CONTAINER: "true"
|
||||||
API_BASE_URL: "http://api.core:8080"
|
DB_CONNECTION_STRING: "${TEST_DB_CONNECTION_STRING}"
|
||||||
|
volumes:
|
||||||
|
- ./test-results:/app/test-results
|
||||||
|
restart: "no"
|
||||||
|
networks:
|
||||||
|
- testnet
|
||||||
|
|
||||||
|
repository.tests:
|
||||||
|
image: repository.tests
|
||||||
|
container_name: test-env-repository-tests
|
||||||
|
depends_on:
|
||||||
|
database.seed:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
build:
|
||||||
|
context: ./src/Core
|
||||||
|
dockerfile: Repository/Repository.Tests/Dockerfile
|
||||||
|
args:
|
||||||
|
BUILD_CONFIGURATION: Release
|
||||||
|
environment:
|
||||||
|
DOTNET_RUNNING_IN_CONTAINER: "true"
|
||||||
DB_CONNECTION_STRING: "${TEST_DB_CONNECTION_STRING}"
|
DB_CONNECTION_STRING: "${TEST_DB_CONNECTION_STRING}"
|
||||||
volumes:
|
volumes:
|
||||||
- ./test-results:/app/test-results
|
- ./test-results:/app/test-results
|
||||||
|
|||||||
@@ -34,6 +34,5 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\API.Core\API.Core.csproj" />
|
<ProjectReference Include="..\API.Core\API.Core.csproj" />
|
||||||
<ProjectReference Include="..\..\Database\Database.Core\Database.Core.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
21
src/Core/Repository/Repository.Tests/Dockerfile
Normal file
21
src/Core/Repository/Repository.Tests/Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["Repository/Repository.Core/Repository.Core.csproj", "Repository/Repository.Core/"]
|
||||||
|
COPY ["Repository/Repository.Tests/Repository.Tests.csproj", "Repository/Repository.Tests/"]
|
||||||
|
RUN dotnet restore "Repository/Repository.Tests/Repository.Tests.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/Repository/Repository.Tests"
|
||||||
|
RUN dotnet build "./Repository.Tests.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "./Repository.Tests.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS final
|
||||||
|
WORKDIR /src
|
||||||
|
# Copy the entire source tree for testing
|
||||||
|
COPY . .
|
||||||
|
RUN mkdir -p /app/test-results
|
||||||
|
WORKDIR /src/Repository/Repository.Tests
|
||||||
|
ENTRYPOINT ["dotnet", "test", "Repository.Tests.csproj", "-c", "Release", "--logger", "trx;LogFileName=/app/test-results/repository-tests.trx"]
|
||||||
Reference in New Issue
Block a user