Files
recipe-app/flutter/Dockerfile
T
Nils-Johan Gynther 69bcc3e342
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 14m6s
Test Suite / flutter-quality (push) Failing after 4m44s
feat(web): improve web build configuration and accessibility
- Add source maps and web renderer build arguments with defaults
- Configure Caddy with CSP headers, cache policies, and service worker handling
- Defer loading of import screen for performance optimization
- Add semantic labels to icons for accessibility
- Update web index.html with Swedish language, meta tags, and description
- Add robots.txt and lighthouse configuration
- Add new planning documents and archive entries
2026-05-23 18:04:27 +02:00

43 lines
1.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Stage 1 Build Flutter web
FROM ghcr.io/cirruslabs/flutter:3.41.9 AS builder
WORKDIR /app
COPY pubspec.yaml pubspec.lock ./
RUN flutter pub get
COPY . .
# Generate localizations (ARB -> Dart) before the main build.
RUN flutter gen-l10n
# Run tests
RUN flutter test
# Inject API base URL at build time via --dart-define.
# Default to same-origin /api to avoid mixed-content in HTTPS deployments.
ARG API_BASE_URL=/api
ARG SOURCE_MAPS=false
ARG WEB_RENDERER=auto
RUN set -eux; \
build_args="--release --dart-define=API_BASE_URL=${API_BASE_URL}"; \
if [ "${SOURCE_MAPS}" = "false" ]; then \
build_args="${build_args} --no-source-maps"; \
fi; \
if [ "${WEB_RENDERER}" != "auto" ]; then \
build_args="${build_args} --web-renderer=${WEB_RENDERER}"; \
fi; \
flutter build web ${build_args}
# Stage 2 Serve with Caddy
FROM caddy:alpine AS runner
ARG PORT=5000
ENV PORT=${PORT}
COPY --from=builder /app/build/web /usr/share/caddy
COPY Caddyfile /etc/caddy/Caddyfile
EXPOSE ${PORT}
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]