From eab23683319d6b84a6077d5d7a3dbe9125f48b27 Mon Sep 17 00:00:00 2001 From: Vusumuzi Khoza Date: Mon, 1 Jun 2026 21:04:06 +0200 Subject: [PATCH] usability fixes --- Dockerfile | 6 +++++- nginx.conf | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 5e41551..d421854 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,6 +42,10 @@ FROM nginx:1.25.2-alpine # copy the info of the builded web app to nginx COPY --from=build-env /app/build/web /usr/share/nginx/html +# Remove default nginx configuration and copy custom one +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/nginx.conf + # Expose and run nginx EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..942fd10 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,38 @@ +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + # Gzip compression + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml; + gzip_min_length 1000; + + # Cache static assets + location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|json)$ { + expires 6M; + access_log off; + add_header Cache-Control "public, immutable"; + } + + # Service worker - no cache + location = /flutter_service_worker.js { + expires -1; + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + # SPA fallback: all requests that don't match a real file go to index.html + location / { + try_files $uri $uri/ /index.html; + } + } +} \ No newline at end of file