#!/bin/sh
set -ex

# Builds the application in production mode, with Webpack profiling
# turned on, and then starts a static server.
# Access profile reports at:
#   http://localhost:3000/profile/bundle-analyzer.html
#   http://localhost:3000/profile/webpack-visualizer.html

docker-compose run -e 'PROFILE_BUILD=true' --service-ports --rm app bash -c 'yarn install && yarn run preview'
