Enable GZIP for Nginx

This commit is contained in:
Quan Tran
2022-04-08 16:18:36 +07:00
committed by Dat H. Pham
parent ec1e3fb075
commit 701502c6b7
2 changed files with 47 additions and 14 deletions
+4 -3
View File
@@ -9,7 +9,7 @@ ENV FLUTTER_HOME="/opt/flutter"
ENV PATH "$PATH:$FLUTTER_HOME/bin"
# Prerequisites
RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa \
RUN apt update && apt install -y curl git unzip xz-utils zip gzip libglu1-mesa \
&& mkdir -p $FLUTTER_HOME \
&& curl -o flutter.tar.xz $FLUTTER_URL \
&& tar xf flutter.tar.xz -C /opt \
@@ -30,12 +30,13 @@ RUN cd core \
&& cd .. \
&& flutter pub get && flutter pub run intl_generator:extract_to_arb --output-dir=./lib/l10n lib/main/localizations/app_localizations.dart \
&& flutter pub get && flutter pub run intl_generator:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/main/localizations/app_localizations.dart lib/l10n/intl*.arb \
&& flutter build web --profile
&& flutter build web --profile \
&& gzip -r -k /app/build/web
# Stage 2 - Create the run-time image
FROM nginx:stable
RUN chmod -R 755 /usr/share/nginx/html
COPY --from=build-env /app/server/nginx.conf /usr/share/nginx/html
COPY --from=build-env /app/server/nginx.conf /etc/nginx
COPY --from=build-env /app/build/web /usr/share/nginx/html
# Record the exposed port