CM Web

build artifact optimization

by RJ and Joaquin

Build Script

+

CUSTOM_TAG=$(date "+%Y%m%d").my_awesome_test
ORIGINAL_TAG='"%s.%s.%s_%s" % (git_date, git_hash, git_branch, env)'

# Edit static values
sed -r -i "s/(^\s*tag = )(.*)$/\1'$CUSTOM_TAG'/" build.py

# build and push container image
python3 build.py --test --dirty

# Reset static values
sed -r -i "s/(^\s*tag = )(.*)$/\1$ORIGINAL_TAG/" build.py

Before

# build and push container image
python3 build.py --test --dirty \
  --tag $(date "+%Y%m%d").my_awesome_test

After

Building Storybook

+

got smaller

Storybook

Building Frontend

+

Size Matters

Front End

Deploying Frontend

+

API_URL=https://stage.clearmetal.org/api

# Edit static values
sed -r -i "s|(__API_URL__: )(.*$)|\1\"'/api'\",|" project.config.js

# build and push container image
python3 build.py --test --dirty

# Reset static values
sed -r -i "s|(__API_URL__: )(.*$)|\1\"'$API_URL'\",|" project.config.js

# Run
docker run -d \
  20190925-212803.820b4ffc.my_really_long_branch_name_that_becomes_my_tag

Before

# build and push container image
python3 build.py --test --dirty

# Run
docker run -d -e API_URL=https://stage.clearmetal.org/api \
  20190925-212803.820b4ffc.my_really_long_branch_name_that_becomes_my_tag

After

Deploy w Kubernetes

SBK_TAG="20190920-235822.WIP_235822.DX-73_StorybookBuildScripts_test"
WEB_TAG="20190918.custom-2"

WEB_HOSTNAME="test.clearmetal.io"
API_HOSTNAME="test.clearmetal.io"
SBK_HOSTNAME="storybook.clearmetal.io"

helm install --name web12 --namespace=test \
  --set api_hostname=$API_HOSTNAME \
  --set web_hostname=$WEB_HOSTNAME \
  --set storybook_hostname=$SBK_HOSTNAME \
  --set image.tag=$WEB_TAG \
  --set storybook_image.tag=$SBK_TAG \
  ./cm-web

The End

CM WebCM Web

By Joaquín Menchaca