From dd6d70b19fcc811ddc9ab280d75d9c16fbdab01d Mon Sep 17 00:00:00 2001 From: R-Bharathraj Date: Mon, 28 Sep 2026 18:20:10 +0530 Subject: [PATCH] updated docker file --- .dockerignore | 14 ++++++++++++++ Dockerfile | 25 +++++++++++++++++++++++++ nginx.conf | 26 ++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) 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..ad96b55 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.git +.github +.dart_tool +build +.idea +.vscode +.claude +android +ios +macos +linux +windows +test +**/*.iml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..321b445 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Flutter web build, served as static files by nginx. +# +# Dokploy builds this repo with its Dockerfile provider, so the image does the +# whole job: pull the Flutter SDK, compile the web bundle, hand the output to a +# web server. Nothing from the build stage survives into the final image but +# build/web. + +FROM ghcr.io/cirruslabs/flutter:stable AS build + +WORKDIR /app + +# Dependencies resolve from the pubspec alone, so copying it first keeps the +# `pub get` layer cached across source-only changes. +COPY pubspec.yaml pubspec.lock ./ +RUN flutter pub get + +COPY . . +RUN flutter build web --release + +FROM nginx:alpine + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/build/web /usr/share/nginx/html + +EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..940bc60 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + # go_router owns the URL, so any path that is not a real file has to come + # back as index.html rather than a 404 — otherwise a reload on /permissions + # or a shared link lands on nothing. + location / { + try_files $uri $uri/ /index.html; + } + + # Build output is content-hashed, the shell is not: caching index.html or + # the service worker would pin returning workers to the previous release. + location = /index.html { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + } + location = /flutter_service_worker.js { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + } + + gzip on; + gzip_types text/plain text/css application/javascript application/json image/svg+xml application/wasm; + gzip_min_length 1024; +}