-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (30 loc) · 961 Bytes
/
Dockerfile
File metadata and controls
42 lines (30 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Flutter Web Dockerfile
# Stage 1: Build the Flutter web app
FROM ghcr.io/cirruslabs/flutter:stable AS builder
WORKDIR /app
# Copy pubspec files first for better caching
COPY pubspec.yaml pubspec.lock ./
# Get Flutter dependencies
RUN flutter pub get
# Copy only the Flutter source code
COPY lib ./lib
COPY web ./web
COPY assets ./assets
COPY .env ./
COPY analysis_options.yaml ./
# Build the web app with WebAssembly
RUN flutter build web --release --wasm
# Stage 2: Serve the web app with nginx
FROM nginx:alpine
# Install curl for health check
RUN apk add --no-cache curl
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the built web app from builder stage
COPY --from=builder /app/build/web /usr/share/nginx/html
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]