0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 22:49:01 -05:00

👷 Build devenv for release

Signed-off-by: mathieu.brunot <mb.mathieu.brunot@gmail.com>
This commit is contained in:
mathieu.brunot 2019-06-11 21:10:07 +02:00
parent a7ed60ee12
commit 15ea62c8d7
No known key found for this signature in database
GPG key ID: 81584BEAF692D7E0
2 changed files with 31 additions and 4 deletions

View file

@ -39,4 +39,4 @@ env:
#- NODE_VERSION=10.16.0 COMMAND=run-devenv #- NODE_VERSION=10.16.0 COMMAND=run-devenv
#- NODE_VERSION=10.16.0 COMMAND=test #- NODE_VERSION=10.16.0 COMMAND=test
- NODE_VERSION=10.16.0 COMMAND=build-release - NODE_VERSION=10.16.0 COMMAND=build-release
#- NODE_VERSION=10.16.0 COMMAND=run-release - NODE_VERSION=10.16.0 COMMAND=run-release

View file

@ -47,6 +47,10 @@ function run-devenv {
} }
function build-release-frontend-local { function build-release-frontend-local {
if ! $(docker images | grep $IMGNAME | grep -q $REV); then
build-devenv
fi
docker run -ti --rm \ docker run -ti --rm \
-w /home/uxbox/uxbox/frontend \ -w /home/uxbox/uxbox/frontend \
-v `pwd`:/home/uxbox/uxbox \ -v `pwd`:/home/uxbox/uxbox \
@ -64,24 +68,43 @@ function build-release-frontend {
rm -rf docker/release.frontend/dist || exit 1; rm -rf docker/release.frontend/dist || exit 1;
} }
function build-release-backend { function build-release-backend-local {
rm -rf docker/release.backend/dist || exit 1; rm -rf backend/dist || exit 1;
rsync -avr \ rsync -avr \
--exclude="/test" \ --exclude="/test" \
--exclude="/resources/public/media" \ --exclude="/resources/public/media" \
--exclude="/target" \ --exclude="/target" \
--exclude="/scripts" \ --exclude="/scripts" \
--exclude="/.*" \ --exclude="/.*" \
backend/ docker/release.backend/dist/; backend/ backend/dist/;
}
function build-release-backend {
build-release-backend-local || exit 1;
rm -rf docker/release.backend/dist || exit 1;
cp -r backend/dist docker/release.backend/ || exit 1;
docker build --rm=true -t ${IMGNAME}-backend:$REV -t ${IMGNAME}-backend:latest docker/release.backend/ docker build --rm=true -t ${IMGNAME}-backend:$REV -t ${IMGNAME}-backend:latest docker/release.backend/
rm -rf docker/release.backend/dist || exit 1; rm -rf docker/release.backend/dist || exit 1;
} }
function build-release { function build-release {
echo "Building frontend release..."
build-release-frontend || exit 1; build-release-frontend || exit 1;
echo "Building backend release..."
build-release-backend || exit 1; build-release-backend || exit 1;
} }
function run-release {
kill-container
if ! $(docker images | grep $IMGNAME-backend | grep -q $REV); then
build-release
fi
echo "Running production images..."
sudo docker-compose -f ./docker/docker-compose.yml up -d
}
function usage { function usage {
echo "UXBOX build & release manager v$REV" echo "UXBOX build & release manager v$REV"
echo "USAGE: $0 OPTION" echo "USAGE: $0 OPTION"
@ -96,6 +119,7 @@ function usage {
echo "- build-release Build 'production ready' docker images for both backend and frontend" echo "- build-release Build 'production ready' docker images for both backend and frontend"
echo "- build-release-frontend Build a 'production ready' docker images for frontend only" echo "- build-release-frontend Build a 'production ready' docker images for frontend only"
echo "- build-release-backend Build a 'production ready' docker images for backend only" echo "- build-release-backend Build a 'production ready' docker images for backend only"
echo "- run-release Run 'production ready' docker images for both backend and frontend"
} }
case $1 in case $1 in
@ -118,6 +142,9 @@ case $1 in
build-release-backend) build-release-backend)
build-release-backend build-release-backend
;; ;;
run-release)
run-release
;;
*) *)
usage usage
;; ;;