Switched to a dedicated flutter base image

This commit is contained in:
Nguyen Thai
2023-02-15 18:05:08 +07:00
committed by Dat Vu
parent 401bc96b32
commit 78fe38414d
+3 -19
View File
@@ -1,22 +1,6 @@
# Stage 1 - Install dependencies and build the app
FROM debian:latest AS build-env
ENV FLUTTER_CHANNEL="stable"
ENV FLUTTER_VERSION="3.7.5"
ENV FLUTTER_URL="https://storage.googleapis.com/flutter_infra_release/releases/$FLUTTER_CHANNEL/linux/flutter_linux_$FLUTTER_VERSION-$FLUTTER_CHANNEL.tar.xz"
ENV FLUTTER_HOME="/opt/flutter"
ENV PATH "$PATH:$FLUTTER_HOME/bin"
# Prerequisites
RUN apt update && apt install -y curl git unzip xz-utils zip gzip libglu1-mesa \
&& mkdir -p $FLUTTER_HOME \
&& git config --global --add safe.directory /opt/flutter \
&& curl -o flutter.tar.xz $FLUTTER_URL \
&& tar xf flutter.tar.xz -C /opt \
&& rm flutter.tar.xz \
&& flutter doctor \
&& rm -rf /var/lib/{apt,dpkg,cache,log}
# This matches the flutter version on our CI/CD pipeline on Github
FROM cirrusci/flutter:3.7.5 AS build-env
# Set directory to Copy App
WORKDIR /app
@@ -36,4 +20,4 @@ COPY --from=build-env /app/build/web /usr/share/nginx/html
EXPOSE 80
# Before stating NGinx, re-zip all the content to ensure customizations are propagated
CMD gzip -k -r /usr/share/nginx/html/ && nginx -g 'daemon off;'
CMD gzip -k -r -f /usr/share/nginx/html/ && nginx -g 'daemon off;'