Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f80388351f | |||
| 9332f77959 | |||
| 6353e0c7b3 | |||
| 1161717f74 | |||
| b50f928318 | |||
| 256858f169 | |||
| fcab8b4a25 | |||
| fa62efc2e3 | |||
| 2fef8bf255 | |||
| 7737dde2ed | |||
| 3a4e8a2f5a |
+51
-15
@@ -4,60 +4,96 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- develop
|
|
||||||
- dev
|
- dev
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: gitea.theriise.net/steinhelge
|
||||||
|
REGISTRY_HOST: gitea.theriise.net
|
||||||
|
REGISTRY_NAMESPACE: steinhelge
|
||||||
|
IMAGE_NAME: minattest
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
wake-zorin:
|
||||||
|
name: Wake Zorin
|
||||||
|
runs-on: waker # t610-waker-runneren med label "waker"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Wake Zorin via WOL
|
||||||
|
run: /home/steinhelge/wake-zorin.sh
|
||||||
|
|
||||||
|
- name: Vent på at Zorin våkner
|
||||||
|
run: sleep 10
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
|
||||||
env:
|
|
||||||
# Denne gir f.eks:
|
|
||||||
# main → latest
|
|
||||||
# develop → dev
|
|
||||||
# dev → dev
|
|
||||||
TAG: ${{ github.ref_name == 'main' && 'latest' || 'dev' }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Finn ut hvilken tag vi skal bruke
|
||||||
|
- name: Set image tag
|
||||||
|
run: |
|
||||||
|
# Gitea prøver å være kompatibel med GitHub Actions
|
||||||
|
# Noen ganger er GITHUB_REF_NAME bare 'main', andre ganger 'refs/heads/main'
|
||||||
|
REF="${GITHUB_REF_NAME:-$GITHUB_REF}"
|
||||||
|
REF="${REF#refs/heads/}"
|
||||||
|
|
||||||
|
if [ "$REF" = "main" ]; then
|
||||||
|
TAG="latest"
|
||||||
|
elif [ "$REF" = "dev" ]; then
|
||||||
|
TAG="dev"
|
||||||
|
else
|
||||||
|
# fallback: bruk branchnavnet som tag, men uten skråstreker
|
||||||
|
TAG="$(echo "$REF" | tr '/' '-')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Bygger med TAG=$TAG"
|
||||||
|
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.theriise.net -u steinhelge --password-stdin
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login $REGISTRY -u steinhelge --password-stdin
|
||||||
|
|
||||||
# ---------- Frontend ----------
|
# ---------- Frontend ----------
|
||||||
- name: Build Frontend (${{ env.TAG }})
|
- name: Build Frontend (${{ env.TAG }})
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
-t gitea.theriise.net/steinhelge/minattest-frontend:${TAG} \
|
-t $REGISTRY/minattest-frontend:${TAG} \
|
||||||
-f frontend/minattest-app/Dockerfile \
|
-f frontend/minattest-app/Dockerfile \
|
||||||
frontend/minattest-app
|
frontend/minattest-app
|
||||||
|
|
||||||
- name: Push Frontend (${{ env.TAG }})
|
- name: Push Frontend (${{ env.TAG }})
|
||||||
run: |
|
run: |
|
||||||
docker push gitea.theriise.net/steinhelge/minattest-frontend:${TAG}
|
docker push $REGISTRY/minattest-frontend:${TAG}
|
||||||
|
|
||||||
# ---------- Backend API ----------
|
# ---------- Backend API ----------
|
||||||
- name: Build API (${{ env.TAG }})
|
- name: Build API (${{ env.TAG }})
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
-t gitea.theriise.net/steinhelge/minattest-api:${TAG} \
|
-t $REGISTRY/minattest-api:${TAG} \
|
||||||
-f backend/Dockerfile \
|
-f backend/Dockerfile \
|
||||||
backend
|
backend
|
||||||
|
|
||||||
- name: Push API (${{ env.TAG }})
|
- name: Push API (${{ env.TAG }})
|
||||||
run: |
|
run: |
|
||||||
docker push gitea.theriise.net/steinhelge/minattest-api:${TAG}
|
docker push $REGISTRY/minattest-api:${TAG}
|
||||||
|
|
||||||
# ---------- App Host / BFF ----------
|
# ---------- App Host / BFF ----------
|
||||||
- name: Build App Host (${{ env.TAG }})
|
- name: Build App Host (${{ env.TAG }})
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
-t gitea.theriise.net/steinhelge/minattest-app-host:${TAG} \
|
-t $REGISTRY/minattest-app-host:${TAG} \
|
||||||
-f frontend/minattest-app-host/Dockerfile \
|
-f frontend/minattest-app-host/Dockerfile \
|
||||||
frontend/minattest-app-host
|
frontend/minattest-app-host
|
||||||
|
|
||||||
- name: Push App Host (${{ env.TAG }})
|
- name: Push App Host (${{ env.TAG }})
|
||||||
run: |
|
run: |
|
||||||
docker push gitea.theriise.net/steinhelge/minattest-app-host:${TAG}
|
docker push $REGISTRY/minattest-app-host:${TAG}
|
||||||
|
|
||||||
|
- name: Deploy (docker compose pull + up)
|
||||||
|
run: |
|
||||||
|
cd /srv/minattest # ← Endre denne pathen hvis compose ligger et annet sted
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [ "Serilog.Sinks.Console" ],
|
"Using": [ "Serilog.Sinks.Console" ],
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Verbose",
|
"Default": "Verbose",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Information"
|
"System": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"WriteTo": [
|
"WriteTo": [
|
||||||
{
|
{
|
||||||
"Name": "Console",
|
"Name": "Console",
|
||||||
"Args": {
|
"Args": {
|
||||||
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console",
|
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console",
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}|{RequestId}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
|
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}|{RequestId}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Enrich": [ "FromLogContext" ]
|
"Enrich": [ "FromLogContext" ]
|
||||||
},
|
},
|
||||||
"ReverseProxy": {
|
"ReverseProxy": {
|
||||||
"Routes": {
|
"Routes": {
|
||||||
"userApiRoute": {
|
"userApiRoute": {
|
||||||
"ClusterId": "clusterUser",
|
"ClusterId": "clusterUser",
|
||||||
"Match": {
|
"Match": {
|
||||||
"Path": "/api/{**catch-all}"
|
"Path": "/api/{**catch-all}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Clusters": {
|
"Clusters": {
|
||||||
"clusterUser": {
|
"clusterUser": {
|
||||||
"Destinations": {
|
"Destinations": {
|
||||||
"destination1": {
|
"destination1": {
|
||||||
"Address": "https://localhost:7172/"
|
"Address": "http://backend-api:8080/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
@@ -1,42 +1,42 @@
|
|||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [ "Serilog.Sinks.Console" ],
|
"Using": [ "Serilog.Sinks.Console" ],
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Verbose",
|
"Default": "Verbose",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Information"
|
"System": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"WriteTo": [
|
"WriteTo": [
|
||||||
{
|
{
|
||||||
"Name": "Console",
|
"Name": "Console",
|
||||||
"Args": {
|
"Args": {
|
||||||
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console",
|
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console",
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}|{RequestId}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
|
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}|{RequestId}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Enrich": [ "FromLogContext" ]
|
"Enrich": [ "FromLogContext" ]
|
||||||
},
|
},
|
||||||
"ReverseProxy": {
|
"ReverseProxy": {
|
||||||
"Routes": {
|
"Routes": {
|
||||||
"userApiRoute": {
|
"userApiRoute": {
|
||||||
"ClusterId": "clusterUser",
|
"ClusterId": "clusterUser",
|
||||||
"Match": {
|
"Match": {
|
||||||
"Path": "/api/{**catch-all}"
|
"Path": "/api/{**catch-all}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Clusters": {
|
"Clusters": {
|
||||||
"clusterUser": {
|
"clusterUser": {
|
||||||
"Destinations": {
|
"Destinations": {
|
||||||
"destination1": {
|
"destination1": {
|
||||||
"Address": "https://localhost:7172/"
|
"Address": "http://backend-api:8080/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user