-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 733 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (23 loc) · 733 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
# Build stage
FROM ghcr.io/cirruslabs/flutter:stable AS builder
WORKDIR /app
# Copy pubspec files
COPY pubspec.yaml pubspec.lock ./
# Get dependencies
RUN flutter pub get
# Copy the rest of the application
COPY . .
# Build argument for API base URL
ARG API_BASE_URL=
# Build the web application with the API_BASE_URL compile-time constant
RUN flutter build web --release --dart-define=API_BASE_URL=${API_BASE_URL}
# Production stage - serve with nginx
FROM nginx:alpine
# Copy built web app to nginx html directory
COPY --from=builder /app/build/web /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]