From e13691df369dcdaeee97ae72523cd5c900ea1e52 Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Sun, 15 Feb 2026 18:59:20 -0500 Subject: [PATCH] add docker config for service auth test --- docker-compose.test.yaml | 20 ++++++++++++++++++ .../Service/Service.Auth.Tests/Dockerfile | 21 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/Core/Service/Service.Auth.Tests/Dockerfile diff --git a/docker-compose.test.yaml b/docker-compose.test.yaml index 06aff2f..1704e87 100644 --- a/docker-compose.test.yaml +++ b/docker-compose.test.yaml @@ -112,6 +112,26 @@ services: networks: - testnet + service.auth.tests: + env_file: ".env.test" + image: service.auth.tests + container_name: test-env-service-auth-tests + depends_on: + database.seed: + condition: service_completed_successfully + build: + context: ./src/Core + dockerfile: Service/Service.Auth.Tests/Dockerfile + args: + BUILD_CONFIGURATION: Release + environment: + DOTNET_RUNNING_IN_CONTAINER: "true" + volumes: + - ./test-results:/app/test-results + restart: "no" + networks: + - testnet + volumes: sqlserverdata-test: driver: local diff --git a/src/Core/Service/Service.Auth.Tests/Dockerfile b/src/Core/Service/Service.Auth.Tests/Dockerfile new file mode 100644 index 0000000..0d67ee9 --- /dev/null +++ b/src/Core/Service/Service.Auth.Tests/Dockerfile @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["Domain.Entities/Domain.Entities.csproj", "Domain.Entities/"] +COPY ["Domain.Exceptions/Domain.Exceptions.csproj", "Domain.Exceptions/"] +COPY ["Infrastructure/Infrastructure.Email/Infrastructure.Email.csproj", "Infrastructure/Infrastructure.Email/"] +COPY ["Infrastructure/Infrastructure.Email.Templates/Infrastructure.Email.Templates.csproj", "Infrastructure/Infrastructure.Email.Templates/"] +COPY ["Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj", "Infrastructure/Infrastructure.Jwt/"] +COPY ["Infrastructure/Infrastructure.Repository/Infrastructure.Repository.csproj", "Infrastructure/Infrastructure.Repository/"] +COPY ["Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj", "Infrastructure/Infrastructure.PasswordHashing/"] +COPY ["Service/Service.Auth/Service.Auth.csproj", "Service/Service.Auth/"] +COPY ["Service/Service.Auth.Tests/Service.Auth.Tests.csproj", "Service/Service.Auth.Tests/"] +RUN dotnet restore "Service/Service.Auth.Tests/Service.Auth.Tests.csproj" +COPY . . +WORKDIR "/src/Service/Service.Auth.Tests" +RUN dotnet build "./Service.Auth.Tests.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS final +RUN mkdir -p /app/test-results/service-auth-tests +WORKDIR /src/Service/Service.Auth.Tests +ENTRYPOINT ["dotnet", "test", "./Service.Auth.Tests.csproj", "-c", "Release", "--logger", "trx;LogFileName=/app/test-results/service-auth-tests/results.trx"]