forked from baron/baron-sso
perf(userfront): optimize login web loading
This commit is contained in:
@@ -8,14 +8,21 @@ RUN /bin/sh ./scripts/sync_userfront_locales.sh
|
||||
WORKDIR /app/userfront
|
||||
RUN flutter pub get
|
||||
RUN touch .env
|
||||
RUN flutter build web --release --no-tree-shake-icons --wasm
|
||||
RUN flutter build web --release --wasm
|
||||
|
||||
FROM node:24-alpine AS optimize
|
||||
WORKDIR /work
|
||||
COPY --from=build /app/userfront/build/web /work/build/web
|
||||
COPY userfront/scripts/optimize-web-build.mjs /work/scripts/optimize-web-build.mjs
|
||||
RUN node /work/scripts/optimize-web-build.mjs /work/build/web
|
||||
|
||||
# Stage 2: Serve with Nginx
|
||||
FROM nginx:alpine
|
||||
FROM alpine:3.23
|
||||
RUN apk add --no-cache nginx nginx-mod-http-brotli
|
||||
# Copy built assets
|
||||
COPY --from=build /app/userfront/build/web /usr/share/nginx/html
|
||||
COPY --from=optimize /work/build/web /usr/share/nginx/html
|
||||
# Copy custom Nginx config
|
||||
COPY userfront/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY userfront/nginx.conf /etc/nginx/http.d/default.conf
|
||||
|
||||
EXPOSE 5000
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user