Skip to content

Commit

Permalink
adjusted docker and pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
cjoergensen committed Oct 27, 2023
1 parent 4affe66 commit 281b67c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 28 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- ".github/workflows/**"

env:
version: 1.0.${{github.run_number}}
version: 0.0.${{github.run_number}}
imageRepository: "cjoergensen/thrifty-elastic-alerting"
DOCKER_CLI_EXPERIMENTAL: "enabled"

Expand All @@ -20,17 +20,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x

- name: Publish
run: dotnet publish ./src -o ./app -r linux-x64 --self-contained true /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true
- name: Build image
shell: bash
run: docker build -t ${{env.imageRepository}}:build-${{env.version}} -f ./src/Kibana.Alerts .
run: docker build -t ${{env.imageRepository}}:${{env.version}} -f ./src/Kibana.Alerts/Dockerfile ./src/Kibana.Alerts/
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
Expand All @@ -39,10 +31,10 @@ jobs:
password: ${{ secrets.DOCKERHUB_USERNAME }}
- name: "docker - tag and push"
run: |
docker pull ${{env.imageRepository}}:build-${{env.version}}-amd64
docker manifest create ${{env.imageRepository}}:${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64
docker manifest create ${{env.imageRepository}}:latest ${{env.imageRepository}}:build-${{env.version}}-amd64
docker manifest push ${{env.imageRepository}}:${{env.version}}
docker manifest push ${{env.imageRepository}}:latest
docker tag ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:${{env.version}}-amd64
docker push ${{env.imageRepository}}:${{env.version}}-amd64
# docker pull ${{env.imageRepository}}:build-${{env.version}}-amd64
# docker manifest create ${{env.imageRepository}}:${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64
# docker manifest create ${{env.imageRepository}}:latest ${{env.imageRepository}}:build-${{env.version}}-amd64
# docker manifest push ${{env.imageRepository}}:${{env.version}}
# docker manifest push ${{env.imageRepository}}:latest
docker tag ${{env.imageRepository}}:${{env.version}} ${{env.imageRepository}}:latest
docker push --all-tags ${{env.imageRepository}}:${{env.version}}
Binary file added app/Kibana.Alerts
Binary file not shown.
13 changes: 13 additions & 0 deletions app/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Smtp": {
"Sender": "cgj@andel.dk",
"Host": "ismtp.seas.local",
"Port": 25
}
}
25 changes: 25 additions & 0 deletions app/internalgroups.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Groups": {
"DevTeam": {
"Connectors": {
"Smtp": {
"Subject": "⏰ {{Name}} is now {{ExecutionStatus.Status}} ⏰",
"Body": "<html><body> <h1>{{Name}}</h1><a href='{{RuleUrl}}'>Check the status here</a></body></html>",
"Audience": [
"cgj@andel.dk",
"min_pan@andel.dk",
"jod@andel.dk"
]
},
"MsTeams": {
"MessageCardJson": "{\"type\": \"AdaptiveCard\",\"body\": [{\"type\": \"TextBlock\",\"size\": \"Medium\",\"weight\": \"Bolder\",\"text\": \"{{Name}} \"},{\"type\": \"TextBlock\",\"text\": \"{{Name}} now has status: {{ExecutionStatus.Status}}.\",\"wrap\": true}],\"actions\": [{\"type\": \"Action.OpenUrl\",\"title\": \"View details\",\"url\": \"{{Ruleurl}}\"}],\"$schema\": \"http:\/\/adaptivecards.io\/schemas\/adaptive-card.json\",\"version\": \"1.6\"}",
"WebHookUrl": "https://seasnve.webhook.office.com/webhookb2/56e4ba63-7031-412f-abff-4150b4bbc2fd@a6096808-b971-440e-99ff-6ea37b046566/IncomingWebhook/7672ebf45d8c46179c66efa1b917f89d/f1235af9-1871-4354-9fc2-094313946151"
}
}
},
"Business": {
"Connectors" : {
}
}
}
}
20 changes: 10 additions & 10 deletions src/Kibana.Alerts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
WORKDIR /app
COPY ["/app", "/app"]
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
RUN apk add --no-cache icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib tzdata
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG TARGETARCH
WORKDIR /source

ENV APP_UID=10000
ENV APP_NAME=appuser
COPY . .
RUN dotnet publish -a $TARGETARCH -o /app --self-contained /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true

RUN adduser -u $APP_UID --disabled-password $APP_NAME
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
WORKDIR /app
COPY --from=build /app .
USER $APP_UID
CMD ["./Kibana.Alerts"]
# ENTRYPOINT ["dotnet", "Kibana.Alerts.dll"]
ENTRYPOINT ["./Kibana.Alerts"]
1 change: 0 additions & 1 deletion src/Kibana.Alerts/Kibana.Alerts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 281b67c

Please sign in to comment.