From 03d32319b01bcffe30c95116b2fcad61206b35cd Mon Sep 17 00:00:00 2001 From: Michal Vrba Date: Mon, 19 Oct 2026 16:55:06 +0200 Subject: [PATCH] Prepare Coolify deployment --- .dockerignore | 10 ++++++++++ Dockerfile | 21 +++++++++++++++++++++ global.json | 4 ++-- nginx.conf | 21 +++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7d02bf0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +.gitignore +.vs +**/bin +**/obj +**/TestResults +tests +*.user +*.suo +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fe1203b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build +WORKDIR /src + +COPY src/SlaySharp.Core/SlaySharp.Core.csproj src/SlaySharp.Core/ +COPY src/SlaySharp.Web/SlaySharp.Web.csproj src/SlaySharp.Web/ +RUN dotnet restore src/SlaySharp.Web/SlaySharp.Web.csproj \ + --source https://api.nuget.org/v3/index.json + +COPY src/SlaySharp.Core/ src/SlaySharp.Core/ +COPY src/SlaySharp.Web/ src/SlaySharp.Web/ +RUN dotnet publish src/SlaySharp.Web/SlaySharp.Web.csproj \ + --configuration Release \ + --output /app/publish \ + --no-restore + +FROM nginx:1.27-alpine AS final +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/publish/wwwroot /usr/share/nginx/html +EXPOSE 8080 +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ + CMD wget --quiet --spider http://127.0.0.1:8080/ || exit 1 diff --git a/global.json b/global.json index c44660e..d07970a 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100-preview.7.23376.3", - "rollForward": "latestFeature" + "version": "8.0.100", + "rollForward": "latestMajor" } } diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d738339 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 8080; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~* \.(?:css|js|json|wasm|webp|png|jpg|jpeg|gif|ico|svg|woff2?|mp3|mp4|wav)$ { + expires 7d; + add_header Cache-Control "public, no-transform"; + try_files $uri =404; + } + + location = /index.html { + add_header Cache-Control "no-cache"; + } +}