0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00
penpot/manage.sh

76 lines
1.6 KiB
Bash
Raw Normal View History

2016-11-20 14:08:24 -05:00
#!/usr/bin/env bash
REV=`git rev-parse --short HEAD`
IMGNAME="uxbox"
function kill_container {
echo "Cleaning development image..."
if $(sudo docker ps | grep -q $IMGNAME); then
sudo docker ps | grep $IMGNAME | awk '{print $1}' | xargs --no-run-if-empty sudo docker kill
2016-11-20 14:08:24 -05:00
fi
}
function build_image {
kill_container
echo "Building development image..."
2016-11-20 14:08:24 -05:00
sudo docker build --rm=true -t $IMGNAME:$REV docker/
}
function run_image {
kill_container
if ! $(sudo docker images | grep $IMGNAME | grep -q $REV); then
2016-11-20 14:08:24 -05:00
build_image
fi
mkdir -p $HOME/.m2
2019-02-14 07:04:05 -05:00
rm -rf ./frontend/node_modules
echo "Running development image..."
2016-11-20 14:08:24 -05:00
sudo docker run -ti \
-v `pwd`:/home/uxbox/uxbox \
2016-11-20 14:08:24 -05:00
-v $HOME/.m2:/home/uxbox/.m2 \
-v $HOME/.gitconfig:/home/uxbox/.gitconfig \
-p 3449:3449 -p 6060:6060 -p 9090:9090 $IMGNAME:$REV
}
function release_image {
cd frontend
echo "Building frontend release..."
rm -rf ./dist
2019-02-14 07:04:05 -05:00
rm -rf ./node_modules
npm install
npm run dist
./scripts/dist-main
./scripts/dist-view
./scripts/dist-worker
echo "Frontend release generated in $(pwd)/dist"
cd ../backend
echo "Building backend release..."
rm -rf ./dist
./scripts/dist.sh
echo "Backend release generated in $(pwd)/dist"
cd ..
}
2016-11-20 14:08:24 -05:00
function usage {
echo "USAGE: $0 [ build | run | release ]"
2016-11-20 14:08:24 -05:00
}
case $1 in
build)
build_image
;;
run)
run_image
;;
release)
release_image
;;
2016-11-20 14:08:24 -05:00
*)
usage
;;
esac