#!/usr/bin/env bash set -euo pipefail NAME=egui-circles BUILDER=djmil/$NAME-builder:0.0.1 TRAGET=$NAME-wasm32 has_docker_image() { docker manifest inspect $1 } &> /dev/null has_docker_container() { docker container inspect $1 } &> /dev/null if ! has_docker_image $BUILDER; then echo "Docker $BUILDER was not found" read -p "Would you like to create builder image (y/n)? " case "$REPLY" in y|Y ) docker build --tag $BUILDER . ;; * ) exit 1 ;; esac fi echo "Initiate WASM32 target build.." if has_docker_container $TRAGET; then docker start \ $TRAGET \ --attach else docker run \ --volume $(pwd)/..:/$NAME \ --name $TRAGET \ $BUILDER \ build --release fi