-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
45 lines (33 loc) · 1.37 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
# Install dependencies and build the app in a build environment
FROM debian:latest AS build-env
# Install flutter dependencies
RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3 sed
RUN apt-get clean
# Clone the flutter repo
RUN git clone https://github.com/flutter/flutter.git -b 3.19.2 --single-branch /usr/local/flutter
# Set flutter path
ENV PATH="${PATH}:/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin"
# Download Dart SDK
RUN flutter doctor
# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
# Run pre-build commands
RUN flutter pub get
# Build the app
RUN flutter build web --release --web-renderer html --dart-define=FLUTTER_WEB_CANVASKIT_URL=https://npm.elemecdn.com/canvaskit-wasm@0.37.1/bin/ --base-href "/moss/"
# Copy assets to build/web
RUN cp -r assets build/web/assets/
# Copy tree-shaked icons
# RUN cp assets/fonts/MaterialIcons-Regular.otf build/web/assets/fonts/MaterialIcons-Regular.otf
# Built web root is at /app/build/web
# Create the run-time image
FROM nginx:1.23.3-alpine
COPY --from=build-env /app/build/web /usr/share/nginx/html/moss
COPY --from=build-env /app/intro_page /usr/share/nginx/html
# Copy nginx config
COPY --from=build-env /app/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]