diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bd086b3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["./TimetableDesigner.Backend.Services.Authentication", "./TimetableDesigner.Backend.Services.Authentication"] +COPY ["./TimetableDesigner.Backend.Services.Authentication.Core", "./TimetableDesigner.Backend.Services.Authentication.Core"] +COPY ["./TimetableDesigner.Backend.Services.Authentication.Database", "./TimetableDesigner.Backend.Services.Authentication.Database"] +COPY ["./TimetableDesigner.Backend.Services.Authentication.DTO.Events", "./TimetableDesigner.Backend.Services.Authentication.DTO.Events"] +COPY ["./TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI", "./TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI"] +RUN dotnet nuget add source --name gitea --username TimetableDesigner --password --mount=type=secret,id=nuget_registry_token --store-password-in-clear-text https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json +RUN dotnet restore "./TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj" +WORKDIR "/src/" +COPY . . +RUN dotnet build "./TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "TimetableDesigner.Backend.Services.Authentication.dll"] \ No newline at end of file diff --git a/TimetableDesigner.Backend.Services.Authentication.Database/TimetableDesigner.Backend.Services.Authentication.Database.csproj b/TimetableDesigner.Backend.Services.Authentication.Database/TimetableDesigner.Backend.Services.Authentication.Database.csproj index 40af1ca..8eafccd 100644 --- a/TimetableDesigner.Backend.Services.Authentication.Database/TimetableDesigner.Backend.Services.Authentication.Database.csproj +++ b/TimetableDesigner.Backend.Services.Authentication.Database/TimetableDesigner.Backend.Services.Authentication.Database.csproj @@ -8,7 +8,7 @@ - + diff --git a/TimetableDesigner.Backend.Services.Authentication/.dockerignore b/TimetableDesigner.Backend.Services.Authentication/.dockerignore deleted file mode 100644 index cd967fc..0000000 --- a/TimetableDesigner.Backend.Services.Authentication/.dockerignore +++ /dev/null @@ -1,25 +0,0 @@ -**/.dockerignore -**/.env -**/.git -**/.gitignore -**/.project -**/.settings -**/.toolstarget -**/.vs -**/.vscode -**/.idea -**/*.*proj.user -**/*.dbmdl -**/*.jfm -**/azds.yaml -**/bin -**/charts -**/docker-compose* -**/Dockerfile* -**/node_modules -**/npm-debug.log -**/obj -**/secrets.dev.yaml -**/values.dev.yaml -LICENSE -README.md \ No newline at end of file diff --git a/TimetableDesigner.Backend.Services.Authentication/Dockerfile b/TimetableDesigner.Backend.Services.Authentication/Dockerfile deleted file mode 100644 index e5fa0e6..0000000 --- a/TimetableDesigner.Backend.Services.Authentication/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base -USER $APP_UID -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 - -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["TimetableDesigner.API.Services.Authentication.csproj", "./"] -RUN dotnet restore "TimetableDesigner.API.Services.Authentication.csproj" -COPY . . -WORKDIR "/src/" -RUN dotnet build "./TimetableDesigner.API.Services.Authentication.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./TimetableDesigner.API.Services.Authentication.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "TimetableDesigner.API.Services.Authentication.dll"] diff --git a/TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj b/TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj index d740385..bec5f90 100644 --- a/TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj +++ b/TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj @@ -18,9 +18,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + @@ -29,8 +29,4 @@ - - - - diff --git a/TimetableDesigner.Backend.Services.Authentication/appsettings.json b/TimetableDesigner.Backend.Services.Authentication/appsettings.json index 62af5b6..34d0762 100644 --- a/TimetableDesigner.Backend.Services.Authentication/appsettings.json +++ b/TimetableDesigner.Backend.Services.Authentication/appsettings.json @@ -8,7 +8,7 @@ "AllowedHosts": "*", "ConnectionStrings": { "Database": "Host=localhost;Port=5433;Database=ttd_authentication;Username=postgres;Password=l4JxOIuSoyod86N;Include Error Detail=True", - "EventQueue": "Hostname=localhost;Port=5672;Username=user;Password=l4JxOIuSoyod86N;ExchangeName=events;QueuePrefix=authentication" + "EventQueue": "Hostname=localhost;Port=5672;Username=user;Password=l4JxOIuSoyod86N;ExchangeName=events;QueuePrefix=authentication;Retries=-1" }, "Tokens": { "AccessToken": {