From 354c25ac06a933a93aa42178a3cbf7c26f546196 Mon Sep 17 00:00:00 2001 From: Byakuya Date: Sat, 26 Jul 2025 12:11:52 +0000 Subject: [PATCH] Ajout du dbContext --- Models/StrapiContext.cs | 28 ++++++++++++++++++++++++++++ administration.dll | 15 +++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Models/StrapiContext.cs create mode 100644 administration.dll diff --git a/Models/StrapiContext.cs b/Models/StrapiContext.cs new file mode 100644 index 0000000..36890d5 --- /dev/null +++ b/Models/StrapiContext.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace administration.Models; + +public partial class StrapiContext : DbContext +{ + public StrapiContext() + { + } + + public StrapiContext(DbContextOptions options) + : base(options) + { + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. + => optionsBuilder.UseNpgsql("Host=postgres;Port=5432;Database=strapi;Username=strapi;Password=Mf33ksTRLrPKSqQ4cTXitgiSN6BPBt89"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/administration.dll b/administration.dll new file mode 100644 index 0000000..69bcb6d --- /dev/null +++ b/administration.dll @@ -0,0 +1,15 @@ +# Dockerfile +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src +COPY . . +RUN dotnet restore +RUN dotnet publish -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=build /app/publish . +ENTRYPOINT ["dotnet", "Administration.dll"] \ No newline at end of file