diff --git a/tests/Agent/IntegrationTests/ContainerApplications/SmokeTestApp/Dockerfile.amazon b/tests/Agent/IntegrationTests/ContainerApplications/SmokeTestApp/Dockerfile.amazon new file mode 100644 index 000000000..3da522139 --- /dev/null +++ b/tests/Agent/IntegrationTests/ContainerApplications/SmokeTestApp/Dockerfile.amazon @@ -0,0 +1,43 @@ +ARG TARGET_ARCH +FROM --platform=${TARGET_ARCH} amazonlinux:latest AS base +WORKDIR /app +EXPOSE 80 + +# build image is always amd64 (to match the runner architecture), even though the target architecture may be arm64 +FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk AS build +ARG TARGET_ARCH +WORKDIR /src +COPY ["SmokeTestApp/SmokeTestApp.csproj", "SmokeTestApp/"] +RUN dotnet restore "SmokeTestApp/SmokeTestApp.csproj" -a ${TARGET_ARCH} + +COPY . . +WORKDIR "/src/SmokeTestApp" +RUN dotnet build "SmokeTestApp.csproj" -c Release -o /app/build --os linux -a ${TARGET_ARCH} + +FROM build AS publish +RUN dotnet publish "SmokeTestApp.csproj" -c Release -o /app/publish /p:UseAppHost=false --os linux -a ${TARGET_ARCH} + +FROM base AS final + +# install asp.netcore - use the Centos 7 package feed because amazon is rhel based +RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm +RUN yum install aspnetcore-runtime-7.0 -y + +# Enable the agent +ARG NEW_RELIC_HOST +ARG NEW_RELIC_LICENSE_KEY +ARG NEW_RELIC_APP_NAME + +ENV CORECLR_ENABLE_PROFILING=1 \ +CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A} \ +CORECLR_NEWRELIC_HOME=/usr/local/newrelic-dotnet-agent \ +CORECLR_PROFILER_PATH=/usr/local/newrelic-dotnet-agent/libNewRelicProfiler.so \ +NEW_RELIC_HOST=${NEW_RELIC_HOST} \ +NEW_RELIC_LICENSE_KEY=${NEW_RELIC_LICENSE_KEY} \ +NEW_RELIC_APP_NAME=${NEW_RELIC_APP_NAME} \ +NEWRELIC_LOG_DIRECTORY=/app/logs + +WORKDIR /app +COPY --from=publish /app/publish . + +ENTRYPOINT ["dotnet", "SmokeTestApp.dll"] diff --git a/tests/Agent/IntegrationTests/ContainerApplications/docker-compose.yml b/tests/Agent/IntegrationTests/ContainerApplications/docker-compose.yml index f582d4f9a..149e84bf9 100644 --- a/tests/Agent/IntegrationTests/ContainerApplications/docker-compose.yml +++ b/tests/Agent/IntegrationTests/ContainerApplications/docker-compose.yml @@ -63,3 +63,13 @@ services: service: smoketestapp build: dockerfile: SmokeTestApp/Dockerfile.centos + AmazonX64SmokeTestApp: + extends: + service: smoketestapp + build: + dockerfile: SmokeTestApp/Dockerfile.amazon + AmazonArm64SmokeTestApp: + extends: + service: smoketestapp + build: + dockerfile: SmokeTestApp/Dockerfile.centos diff --git a/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs b/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs index 580c017be..c7e15c30c 100644 --- a/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs +++ b/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs @@ -79,3 +79,20 @@ public class CentosArm64SmokeTestFixture : LinuxSmokeTestFixtureBase public CentosArm64SmokeTestFixture() : base(ApplicationDirectoryName, DistroTag, Architecture) { } } + +public class AmazonX64SmokeTestFixture : LinuxSmokeTestFixtureBase +{ + private static readonly string ApplicationDirectoryName = "AmazonX64SmokeTestApp"; + private static readonly ContainerApplication.Architecture Architecture = ContainerApplication.Architecture.X64; + private static readonly string DistroTag = "Amazon"; + + public AmazonX64SmokeTestFixture() : base(ApplicationDirectoryName, DistroTag, Architecture) { } +} +public class AmazonArm64SmokeTestFixture : LinuxSmokeTestFixtureBase +{ + private static readonly string ApplicationDirectoryName = "AmazonArm64SmokeTestApp"; + private static readonly ContainerApplication.Architecture Architecture = ContainerApplication.Architecture.Arm64; + private static readonly string DistroTag = "Amazon"; + + public AmazonArm64SmokeTestFixture() : base(ApplicationDirectoryName, DistroTag, Architecture) { } +} diff --git a/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs b/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs index dac395e14..dd1e564b0 100644 --- a/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs +++ b/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs @@ -94,3 +94,17 @@ public CentosArm64SmokeTest(CentosArm64SmokeTestFixture fixture, ITestOutputHelp { } } + +public class AmazonX64SmokeTest : LinuxSmokeTest +{ + public AmazonX64SmokeTest(AmazonX64SmokeTestFixture fixture, ITestOutputHelper output) : base(fixture, output) + { + } +} + +public class AmazonArm64SmokeTest : LinuxSmokeTest +{ + public AmazonArm64SmokeTest(AmazonArm64SmokeTestFixture fixture, ITestOutputHelper output) : base(fixture, output) + { + } +}