From 3faee81a20df9945a275d2177ef2c8a99da828e2 Mon Sep 17 00:00:00 2001 From: VPKSoft Date: Sun, 23 Mar 2025 19:46:41 +0200 Subject: [PATCH 1/2] Fix the docker file. --- PasswordKeeper.Server/Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/PasswordKeeper.Server/Dockerfile b/PasswordKeeper.Server/Dockerfile index b134c95..1e9c4f2 100644 --- a/PasswordKeeper.Server/Dockerfile +++ b/PasswordKeeper.Server/Dockerfile @@ -1,20 +1,24 @@ FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base USER $APP_UID WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 +EXPOSE 8000 +EXPOSE 8001 FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src -COPY ["PasswordKeeper.Server/PasswordKeeper.Server.csproj", "PasswordKeeper.Server/"] COPY ["PasswordKeeper.BusinessLogic/PasswordKeeper.BusinessLogic.csproj", "PasswordKeeper.BusinessLogic/"] -COPY ["PasswordKeeper.DataAccess/PasswordKeeper.DataAccess.csproj", "PasswordKeeper.DataAccess/"] +COPY ["PasswordKeeper.Classes/PasswordKeeper.Classes.csproj", "PasswordKeeper.Classes/"] COPY ["PasswordKeeper.DAO/PasswordKeeper.DAO.csproj", "PasswordKeeper.DAO/"] +COPY ["PasswordKeeper.DataAccess/PasswordKeeper.DataAccess.csproj", "PasswordKeeper.DataAccess/"] +COPY ["PasswordKeeper.DatabaseMigrations/PasswordKeeper.DatabaseMigrations.csproj", "PasswordKeeper.DatabaseMigrations/"] COPY ["PasswordKeeper.DTO/PasswordKeeper.DTO.csproj", "PasswordKeeper.DTO/"] COPY ["PasswordKeeper.Interfaces/PasswordKeeper.Interfaces.csproj", "PasswordKeeper.Interfaces/"] -COPY ["DbMigrate/DbMigrate.csproj", "DbMigrate/"] -RUN dotnet restore "PasswordKeeper.Server/PasswordKeeper.Server.csproj"§ +COPY ["PasswordKeeper.Server/PasswordKeeper.Server.csproj", "PasswordKeeper.Server/"] +COPY ["./Directory.Build.props", "/"] +COPY ["./Directory.Build.targets", "/"] + +RUN dotnet restore "PasswordKeeper.Server/PasswordKeeper.Server.csproj" COPY . . WORKDIR "/src/PasswordKeeper.Server" RUN dotnet build "PasswordKeeper.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build From 1add9a91fa679e77ffa66ebec71cf8fe88ccbbbc Mon Sep 17 00:00:00 2001 From: VPKSoft Date: Tue, 25 Mar 2025 17:31:07 +0200 Subject: [PATCH 2/2] Running on Docker now with self-signed certificate. --- .github/workflows/dotnet.yml | 2 ++ Directory.Build.props | 7 +++++++ PasswordKeeper.Server/Dockerfile | 4 ++++ .../PasswordKeeper.Server.csproj | 15 +++++++++++++-- PasswordKeeperServer.sln | 1 + 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9e74c03..bb7f200 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -13,6 +13,8 @@ jobs: build: runs-on: ubuntu-latest environment: PrTest + env: + AspNetCert: ${{ secrets.AspNetCert }} steps: - uses: actions/checkout@v4 diff --git a/Directory.Build.props b/Directory.Build.props index b6340c5..aa0c158 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -15,4 +15,11 @@ CS8618 + + + + true + true + true + \ No newline at end of file diff --git a/PasswordKeeper.Server/Dockerfile b/PasswordKeeper.Server/Dockerfile index 1e9c4f2..4ffdbce 100644 --- a/PasswordKeeper.Server/Dockerfile +++ b/PasswordKeeper.Server/Dockerfile @@ -30,4 +30,8 @@ RUN dotnet publish "PasswordKeeper.Server.csproj" -c $BUILD_CONFIGURATION -o /ap FROM base AS final WORKDIR /app COPY --from=publish /app/publish . + +RUN mkdir -p /app/Certificates +COPY "PasswordKeeper.Server/CertGen/AspNetApp.pfx" /app/Certificates + ENTRYPOINT ["dotnet", "PasswordKeeper.Server.dll"] diff --git a/PasswordKeeper.Server/PasswordKeeper.Server.csproj b/PasswordKeeper.Server/PasswordKeeper.Server.csproj index 9009082..f279d39 100644 --- a/PasswordKeeper.Server/PasswordKeeper.Server.csproj +++ b/PasswordKeeper.Server/PasswordKeeper.Server.csproj @@ -1,4 +1,4 @@ - + Linux @@ -7,7 +7,7 @@ - + @@ -27,4 +27,15 @@ + + + Always + + + + + + + + diff --git a/PasswordKeeperServer.sln b/PasswordKeeperServer.sln index c882235..0f8a5ad 100644 --- a/PasswordKeeperServer.sln +++ b/PasswordKeeperServer.sln @@ -8,6 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets LICENSE = LICENSE + .github\workflows\dotnet.yml = .github\workflows\dotnet.yml EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PasswordKeeper.DatabaseMigrations", "PasswordKeeper.DatabaseMigrations\PasswordKeeper.DatabaseMigrations.csproj", "{2047B929-7D63-440A-A1C1-BABAE744194B}"