update mih ui with stable flutter and optimised docker file caching
This commit is contained in:
@@ -3,17 +3,19 @@ FROM debian:latest AS build-env
|
||||
|
||||
# Install necessary dependencies for Flutter
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl git wget unzip libglu1-mesa fonts-droid-fallback python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
curl git wget unzip libglu1-mesa fonts-droid-fallback python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Clone Flutter SDK
|
||||
RUN git clone -b flutter-3.32-candidate.0 https://github.com/flutter/flutter.git /usr/local/flutter
|
||||
RUN git clone -b stable https://github.com/flutter/flutter.git /usr/local/flutter
|
||||
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
|
||||
|
||||
# Build the Flutter web app
|
||||
RUN flutter config --enable-web && flutter precache --web
|
||||
WORKDIR /app
|
||||
COPY pubspec.yaml pubspec.lock ./
|
||||
RUN flutter pub get
|
||||
COPY . .
|
||||
RUN flutter config --enable-web
|
||||
RUN flutter build web --release -t ./lib/main_prod.dart
|
||||
|
||||
# --- STAGE 2: The Final Production Image ---
|
||||
@@ -24,13 +26,13 @@ COPY --from=build-env /app/build/web /usr/share/nginx/html
|
||||
|
||||
# Create the Nginx config inside the Dockerfile to handle SPA routing
|
||||
RUN echo 'server { \
|
||||
listen 83; \
|
||||
location / { \
|
||||
root /usr/share/nginx/html; \
|
||||
index index.html; \
|
||||
try_files $uri $uri/ /index.html; \
|
||||
} \
|
||||
}' > /etc/nginx/conf.d/default.conf
|
||||
listen 83; \
|
||||
location / { \
|
||||
root /usr/share/nginx/html; \
|
||||
index index.html; \
|
||||
try_files $uri $uri/ /index.html; \
|
||||
} \
|
||||
}' > /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 83
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user