From 402aec9f0e61be7daaea0e0c787b955a8fd14343 Mon Sep 17 00:00:00 2001 From: Michal Vrba Date: Mon, 19 Oct 2026 15:58:17 +0200 Subject: [PATCH] Prepare Coolify deployment --- .dockerignore | 9 +++++++++ Dockerfile | 24 ++++++++++++++++++++++++ deploy/nginx.conf | 27 +++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 deploy/nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..316e0c3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.gitignore +.vs +**/bin +**/obj +**/*.user +**/*.suo +README* + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5939359 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build +WORKDIR /src + +COPY Faraon.Core/Faraon.Core.csproj Faraon.Core/ +COPY Faraon.Client/Faraon.Client.csproj Faraon.Client/ +RUN dotnet restore Faraon.Client/Faraon.Client.csproj \ + --source https://api.nuget.org/v3/index.json + +COPY Faraon.Core/ Faraon.Core/ +COPY Faraon.Client/ Faraon.Client/ +RUN dotnet publish Faraon.Client/Faraon.Client.csproj \ + --configuration Release \ + --output /app/publish \ + --no-restore + +FROM nginx:1.29-alpine AS final +COPY deploy/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/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 0000000..2cb02c4 --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,27 @@ +server { + listen 8080; + listen [::]:8080; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location = /index.html { + add_header Cache-Control "no-cache"; + } + + location /_framework/ { + try_files $uri =404; + add_header Cache-Control "public, max-age=31536000, immutable"; + } + + location ~* \.(?:css|js|svg|png|jpg|jpeg|gif|ico|webp|woff2?|mp3|ogg|flac|m4a|wav|aac)$ { + try_files $uri =404; + expires 7d; + add_header Cache-Control "public"; + } +}