test
All checks were successful
Main Build Process / if_merged (pull_request) Has been skipped

This commit is contained in:
2024-09-07 16:45:56 +02:00
parent aa2694585e
commit e6e716de79
10 changed files with 100 additions and 13 deletions

View File

@@ -0,0 +1,22 @@
name: "Main Build Process"
on:
pull_request:
branches: ["main"]
jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore ./src/LittleTown.sln
- name: Build
run: dotnet build ./src/LittleTown.sln
- name: Test with the dotnet CLI
run: dotnet test ./src/LittleTown.sln

View File

@@ -1,18 +1,18 @@
name: "Main Build Process"
# Runs on main branch commits,
# every commit in a pull request, any published release.
on:
push:
branches: ["main"]
pull_request:
types:
- closed
branches: ["main"]
release:
types: [published]
jobs:
asciidoc:
name: "generate documentation"
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
@@ -26,9 +26,15 @@ jobs:
program: "asciidoctor -D docs --backend=html5 -o index.html documentation/readme.adoc"
- name: Print execution time
run: echo "Time ${{ steps.adocbuild.outputs.time }}"
- name: Deploy docs to ghpages
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Doc
path: ./docs
retention-days: 5
- name: build docker images
run: docker build -t gitea.borealian.ovh/mcmuzzle/ludikzone:latest -f ./docker-prod/Dockerfile .
- name: upload image
run: |
echo "${{ secrets.PERSO_GITEAPASSWORD}}" | docker login gitea.borealian.ovh --username mcmuzzle --password-stdin
docker push gitea.borealian.ovh/mcmuzzle/ludikzone:latest

3
.gitignore vendored
View File

@@ -19,4 +19,5 @@ tools/
TestResults
#docker data
/docker-dev/data
/docker-dev/data
/docker-prod/data

5
docker-prod/.env Normal file
View File

@@ -0,0 +1,5 @@
DB_HOST="postgresql"
DB_PORT=5432
DB_USER="admin"
DB_PASSWORD="admin"
DB_DATABASE="ludikZone"

5
docker-prod/.env.example Normal file
View File

@@ -0,0 +1,5 @@
DB_HOST="localhost"
DB_PORT=5432
DB_USER="admin"
DB_PASSWORD="admin"
DB_DATABASE="ludikZone"

21
docker-prod/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["src/LudikZoneBlazor/LudikZoneBlazor.csproj", "src/LudikZoneBlazor/LudikZoneBlazor.csproj"]
RUN dotnet restore "src/LudikZoneBlazor/LudikZoneBlazor.csproj"
COPY src src
RUN ls -a -l
RUN dotnet build "src/LudikZoneBlazor/LudikZoneBlazor.csproj" -c Release -o /app/build
FROM build AS publish
WORKDIR /src
RUN dotnet publish "src/LudikZoneBlazor/LudikZoneBlazor.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LudikZoneBlazor.dll"]

24
docker-prod/compose.yml Normal file
View File

@@ -0,0 +1,24 @@
services:
postgresql:
image: postgres:16
ports:
- "${DB_PORT:-5432}:5432"
volumes:
- ./data/postgres/:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_DATABASE:-ludikZone}
- POSTGRES_USER=${DB_USER:-admin}
- POSTGRES_PASSWORD=${DB_PASSWORD:-admin}
ludikzone:
image: gitea.borealian.ovh/mcmuzzle/ludikzone:latest
ports:
- 8080:8080
environment:
- DB_HOST=${DB_HOST:-"postgresql"}
- DB_PORT=${DB_PORT:-5432}
- DB_USER=${DB_USER:-"admin"}
- DB_PASSWORD=${DB_PASSWORD:-"admin"}
- DB_DATABASE=${DB_DATABASE:-"ludikZone"}
depends_on:
- postgresql

View File

@@ -7,10 +7,6 @@
<UserSecretsId>aspnet-LudikZoneBlazor-b18f2a2e-d082-4232-8521-6cacaa2a4ba2</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<None Update="Data\app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.*" />

View File

@@ -74,4 +74,11 @@ app.MapRazorComponents<App>()
// Add additional endpoints required by the Identity /Account Razor components.
app.MapAdditionalIdentityEndpoints();
// Appliquer les migrations automatiquement lors du démarrage
using (var scope = app.Services.CreateScope())
{
var dbContext = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
dbContext.Database.Migrate(); // Applique les migrations
}
app.Run();

View File

@@ -1,12 +1,12 @@
{
"ConnectionStrings": {
"DefaultConnection": "DataSource=Data\\app.db;Cache=Shared"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "host=localhost;username=admin;database=ludikZone;Pooling=false;Timeout=300;CommandTimeout=300;Port=5432;"
},
"AllowedHosts": "*"
}