Skip to content

Commit

Permalink
Added Amazon Linux x64 & amd64
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr committed Jul 25, 2023
1 parent bd96e4b commit 337d257
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,17 @@ public CentosArm64SmokeTest(CentosArm64SmokeTestFixture fixture, ITestOutputHelp
{
}
}

public class AmazonX64SmokeTest : LinuxSmokeTest<AmazonX64SmokeTestFixture>
{
public AmazonX64SmokeTest(AmazonX64SmokeTestFixture fixture, ITestOutputHelper output) : base(fixture, output)
{
}
}

public class AmazonArm64SmokeTest : LinuxSmokeTest<AmazonArm64SmokeTestFixture>
{
public AmazonArm64SmokeTest(AmazonArm64SmokeTestFixture fixture, ITestOutputHelper output) : base(fixture, output)
{
}
}

0 comments on commit 337d257

Please sign in to comment.