Flutter's PWA service worker caches the entire app shell aggressively, causing users to see old versions even after deploys. Disabling it lets nginx cache headers take effect. Also unregisters any existing service worker already installed on user devices. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
421 B
Docker
19 lines
421 B
Docker
# Stage 1: Build Flutter Web
|
|
FROM ghcr.io/cirruslabs/flutter:stable AS builder
|
|
|
|
WORKDIR /app
|
|
COPY pubspec.yaml pubspec.lock ./
|
|
RUN flutter pub get
|
|
|
|
COPY . .
|
|
RUN flutter build web --release --base-href / --pwa-strategy=none
|
|
|
|
# Stage 2: Serve with nginx
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/build/web /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|