-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6ccd77
commit 5ec6f9f
Showing
12 changed files
with
199 additions
and
83 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,48 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env | ||
ARG NUGET_TOKEN | ||
ARG PROJECT_NAME | ||
# The `platform` argument here is required, since dotnet-sdk crashes with segmentation fault | ||
# in case of arm64 builds, see https://github.com/dotnet/dotnet-docker/issues/4225 for details | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env | ||
|
||
ARG INSTALL_DD_TRACER="true" | ||
ARG TRACER_VERSION="2.49.0" | ||
ARG TARGETARCH | ||
|
||
WORKDIR /app | ||
|
||
# Copy csproj and restore as distinct layers | ||
COPY src/*.csproj ./ | ||
RUN dotnet nuget add source --username USERNAME --password $NUGET_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/SneaksAndData/index.json" | ||
RUN dotnet restore | ||
RUN dotnet_arch=$(test "$TARGETARCH" = "amd64" && echo "x64" || echo "$TARGETARCH") && \ | ||
dotnet restore --runtime "linux-$dotnet_arch" | ||
|
||
# Copy everything else and build | ||
COPY src/. ./ | ||
RUN dotnet publish "$PROJECT_NAME.csproj" -c Release -o out | ||
RUN dotnet_arch=$(test "$TARGETARCH" = "amd64" && echo "x64" || echo "$TARGETARCH") && \ | ||
dotnet publish "Arcane.Stream.Cdm.csproj" -c Release -o out --runtime "linux-$dotnet_arch" | ||
|
||
# Build runtime image | ||
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim | ||
ARG TRACER_VERSION="2.32.0" | ||
ARG PROJECT_NAME | ||
ENV PROJECT_ASSEMBLY=$PROJECT_NAME | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim | ||
|
||
ARG TRACER_VERSION="2.49.0" | ||
ARG INSTALL_DD_TRACER="true" | ||
ARG TARGETARCH | ||
|
||
RUN apt-get update -y && apt-get install -y curl jq | ||
|
||
# Download and install the Datadog Tracer | ||
RUN mkdir -p /opt/datadog \ | ||
&& mkdir -p /var/log/datadog \ | ||
&& curl -LO https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb \ | ||
&& dpkg -i ./datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb \ | ||
&& rm ./datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb | ||
RUN if [ -z "$INSTALL_DD_TRACER" ]; then \ | ||
echo "Datadog tracer installation skipped"; \ | ||
else \ | ||
mkdir -p /opt/datadog \ | ||
&& echo $TARGETARCH \ | ||
&& mkdir -p /var/log/datadog \ | ||
&& curl -LO https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_${TARGETARCH}.deb \ | ||
&& dpkg -i ./datadog-dotnet-apm_${TRACER_VERSION}_${TARGETARCH}.deb \ | ||
&& rm ./datadog-dotnet-apm_${TRACER_VERSION}_${TARGETARCH}.deb ; \ | ||
fi; | ||
|
||
|
||
WORKDIR /app | ||
COPY --from=build-env /app/out . | ||
ENTRYPOINT "dotnet" "$PROJECT_ASSEMBLY.dll" | ||
|
||
USER app | ||
|
||
ENTRYPOINT "dotnet" "Arcane.Stream.Cdm.dll" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,38 +5,37 @@ on: | |
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# ! Replace DotnetProject and dotnet-project with project name in real repository | ||
env: | ||
PROJECT_NAME: DotnetProject | ||
PROJECT_NAME_LOWER: dotnet-project | ||
|
||
PROJECT_NAME: Arcane.Stream.Cdm | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
validate_commit: | ||
name: Validate commit | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref != 'refs/heads/main' }} | ||
permissions: | ||
id-token: write # required for dependabot PRs | ||
pull-requests: write # required for dependabot PRs | ||
contents: read # required for dependabot PRs | ||
pull-requests: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 6.0.x | ||
dotnet-version: 8.0.x | ||
- name: Restore dependencies | ||
env: | ||
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore | ||
- name: Test | ||
working-directory: ./test | ||
run: | | ||
dotnet add package coverlet.msbuild && | ||
dotnet test ${PROJECT_NAME}Tests.csproj --configuration Debug --runtime linux-x64 /p:CollectCoverage=true /p:CoverletOutput=Coverage/ /p:CoverletOutputFormat=lcov --logger GitHubActions | ||
dotnet test ${PROJECT_NAME}.Tests.csproj --configuration Debug --runtime linux-x64 /p:CollectCoverage=true /p:CoverletOutput=Coverage/ /p:CoverletOutputFormat=lcov --logger GitHubActions | ||
- name: Publish Code Coverage | ||
if: ${{ github.event_name == 'pull_request' && always() }} | ||
uses: romeovs/[email protected] | ||
|
@@ -48,9 +47,7 @@ jobs: | |
name: Build Docker Image and Helm Charts | ||
runs-on: ubuntu-latest | ||
needs: [ validate_commit ] | ||
# Remove the line below and uncomment the next one | ||
if: ${{ false }} | ||
# if: ${{ always() && (needs.validate_commit.result == 'success' || needs.validate_commit.result == 'skipped') }} | ||
if: ${{ always() && (needs.validate_commit.result == 'success' || needs.validate_commit.result == 'skipped') }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
@@ -100,7 +97,7 @@ jobs: | |
- name: Build and Push Chart | ||
uses: SneaksAndData/github-actions/[email protected] | ||
with: | ||
application: ${{ github.repository }} | ||
application: arcane-stream-cdm-change-feed | ||
app_version: ${{ steps.meta.outputs.version }} | ||
container_registry_user: ${{ github.actor }} | ||
container_registry_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.