From ae7c55cce3c8e0a98062814692f9f266f401d24d Mon Sep 17 00:00:00 2001 From: Sergey Karmanov Date: Sat, 6 Sep 2025 19:28:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20docker=20=D0=BF=D0=BE=D0=B4=20Playwright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SfeduSchedule/Dockerfile | 30 ++++++++++++++++-------------- docker-compose-prod.yml | 5 +++++ docker-compose-test.yml | 2 ++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/SfeduSchedule/Dockerfile b/SfeduSchedule/Dockerfile index 5bd42c1..91634cf 100644 --- a/SfeduSchedule/Dockerfile +++ b/SfeduSchedule/Dockerfile @@ -1,22 +1,24 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine3.22 AS base -USER $APP_UID -WORKDIR /app -EXPOSE 8080 - FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine3.22 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src -COPY ["SfeduSchedule.csproj", "SfeduSchedule.csproj"] -RUN dotnet restore "SfeduSchedule.csproj" COPY . . -WORKDIR "/src" -RUN dotnet build "SfeduSchedule.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release +RUN dotnet restore "SfeduSchedule.csproj" RUN dotnet publish "SfeduSchedule.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false -FROM base AS final +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final +EXPOSE 8080 WORKDIR /app -COPY --from=publish /app/publish . + +RUN apt-get update && \ + apt-get install -y --no-install-recommends wget && \ + wget -q https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/powershell_7.5.2-1.deb_amd64.deb && \ + apt-get install -y ./powershell_7.5.2-1.deb_amd64.deb && \ + rm -f powershell_7.5.2-1.deb_amd64.deb && \ + rm -rf /var/lib/apt/lists/* + +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright + +COPY --from=build /app/publish . +RUN pwsh ./playwright.ps1 install --with-deps chromium + ENTRYPOINT ["dotnet", "SfeduSchedule.dll"] \ No newline at end of file diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml index 7a64cb2..c454b21 100644 --- a/docker-compose-prod.yml +++ b/docker-compose-prod.yml @@ -13,5 +13,10 @@ services: - MS_USERNAME=${MS_USERNAME} - MS_PASSWORD=${MS_PASSWORD} # - TOKEN= + volumes: + - data:/app/data restart: always image: git.zetcraft.ru/serega404/sfeduschedule:main + +volumes: + data: \ No newline at end of file diff --git a/docker-compose-test.yml b/docker-compose-test.yml index 6ffb4eb..7be1441 100644 --- a/docker-compose-test.yml +++ b/docker-compose-test.yml @@ -13,6 +13,8 @@ services: - MS_USERNAME= - MS_PASSWORD= # - TOKEN= + volumes: + - ./data:/app/data restart: unless-stopped build: context: ./SfeduSchedule