Ajout du build et publish docker #13
22
.gitea/workflows/Review.yaml
Normal file
22
.gitea/workflows/Review.yaml
Normal 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
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
name: "Main Build Process"
|
name: "Main Build Process"
|
||||||
|
|
||||||
# Runs on main branch commits,
|
|
||||||
# every commit in a pull request, any published release.
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
asciidoc:
|
if_merged:
|
||||||
name: "generate documentation"
|
if: github.event.pull_request.merged == true
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -26,9 +26,15 @@ jobs:
|
|||||||
program: "asciidoctor -D docs --backend=html5 -o index.html documentation/readme.adoc"
|
program: "asciidoctor -D docs --backend=html5 -o index.html documentation/readme.adoc"
|
||||||
- name: Print execution time
|
- name: Print execution time
|
||||||
run: echo "Time ${{ steps.adocbuild.outputs.time }}"
|
run: echo "Time ${{ steps.adocbuild.outputs.time }}"
|
||||||
- name: Deploy docs to ghpages
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Doc
|
name: Doc
|
||||||
path: ./docs
|
path: ./docs
|
||||||
retention-days: 5
|
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
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,3 +20,4 @@ TestResults
|
|||||||
|
|
||||||
#docker data
|
#docker data
|
||||||
/docker-dev/data
|
/docker-dev/data
|
||||||
|
/docker-prod/data
|
||||||
5
docker-prod/.env
Normal file
5
docker-prod/.env
Normal 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
5
docker-prod/.env.example
Normal 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
21
docker-prod/Dockerfile
Normal 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
24
docker-prod/compose.yml
Normal 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
|
||||||
@@ -7,10 +7,6 @@
|
|||||||
<UserSecretsId>aspnet-LudikZoneBlazor-b18f2a2e-d082-4232-8521-6cacaa2a4ba2</UserSecretsId>
|
<UserSecretsId>aspnet-LudikZoneBlazor-b18f2a2e-d082-4232-8521-6cacaa2a4ba2</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="Data\app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.*" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.*" />
|
||||||
|
|||||||
@@ -74,4 +74,11 @@ app.MapRazorComponents<App>()
|
|||||||
// Add additional endpoints required by the Identity /Account Razor components.
|
// Add additional endpoints required by the Identity /Account Razor components.
|
||||||
app.MapAdditionalIdentityEndpoints();
|
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();
|
app.Run();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
|
||||||
"DefaultConnection": "DataSource=Data\\app.db;Cache=Shared"
|
|
||||||
},
|
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "host=localhost;username=admin;database=ludikZone;Pooling=false;Timeout=300;CommandTimeout=300;Port=5432;"
|
||||||
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user