-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
83 lines (66 loc) · 2.1 KB
/
Dockerfile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM debian:bullseye-slim AS test
# Install required dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
unzip \
xz-utils \
zip \
libglu1-mesa \
imagemagick \
&& rm -rf /var/lib/apt/lists/*
# Install Flutter
RUN git clone https://github.com/flutter/flutter.git /flutter
ENV PATH="/flutter/bin:${PATH}"
# Configure Flutter
RUN flutter channel stable && \
flutter upgrade && \
flutter config --enable-web
WORKDIR /app
COPY . .
# Get dependencies and run tests
RUN flutter pub get && \
flutter test --coverage
FROM debian:bullseye-slim AS build
# Install required dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
unzip \
xz-utils \
zip \
libglu1-mesa \
imagemagick \
&& rm -rf /var/lib/apt/lists/*
# Install Flutter
RUN git clone https://github.com/flutter/flutter.git /flutter
ENV PATH="/flutter/bin:${PATH}"
# Configure Flutter
RUN flutter channel stable && \
flutter upgrade && \
flutter config --enable-web
WORKDIR /app
COPY . .
# Update web icons with Android icons
RUN cp android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png web/favicon.png && \
convert android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -resize 192x192 web/icons/Icon-192.png && \
convert android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -resize 192x192 web/icons/Icon-maskable-192.png && \
convert android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -resize 512x512 web/icons/Icon-512.png && \
convert android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -resize 512x512 web/icons/Icon-maskable-512.png
# Get Flutter dependencies and build for web
RUN flutter pub get && \
flutter build web
# Production stage
FROM nginx:alpine
# Copy the built web files to nginx
COPY --from=build /app/build/web /usr/share/nginx/html
# Configure nginx to handle Flutter web routing
RUN echo 'server { \
listen 80; \
location / { \
root /usr/share/nginx/html; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]