diff --git a/Dockerfile b/Dockerfile index 12def7a99..2e68c8cad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/server/nginx.conf b/server/nginx.conf index 758a646e5..8073c4157 100644 --- a/server/nginx.conf +++ b/server/nginx.conf @@ -1,17 +1,49 @@ -server { +user nginx; +worker_processes auto; - listen 80; +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; - } +events { + worker_connections 1024; +} - error_page 500 502 503 504 /50x.html; +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; - location = /50x.html { - root /usr/share/nginx/html; - } + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + include /etc/nginx/conf.d/*.conf; + + server { + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + + location = /50x.html { + root /usr/share/nginx/html; + } + } + + gzip_static on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_http_version 1.1; } \ No newline at end of file