0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

misc: naming refactor on build process

This commit is contained in:
Andrey Antukh 2019-07-04 11:56:52 +02:00
parent 6a75eb893c
commit 5ecd86ba02
11 changed files with 76 additions and 84 deletions

4
.gitignore vendored
View file

@ -26,8 +26,8 @@ node_modules
/frontend/resources/public/js /frontend/resources/public/js
/frontend/resources/public/view /frontend/resources/public/view
/frontend/resources/public/index.html /frontend/resources/public/index.html
/docker/release.frontend/dist /docker/frontend/dist
/docker/release.backend/dist /docker/backend/dist
/media /media
/deploy /deploy
/web /web

View file

@ -3,7 +3,7 @@ version: "3"
volumes: volumes:
backend_m2: backend_m2:
backend_data: backend_data:
db_data: pgdb_data:
networks: networks:
default: default:
@ -13,7 +13,7 @@ networks:
- subnet: 172.177.10.0/24 - subnet: 172.177.10.0/24
services: services:
uxdb: pgdb:
image: postgres:11 image: postgres:11
restart: always restart: always
ports: ports:
@ -24,16 +24,15 @@ services:
- POSTGRES_USER=uxbox - POSTGRES_USER=uxbox
- POSTGRES_PASSWORD=uxbox_postgres_password - POSTGRES_PASSWORD=uxbox_postgres_password
volumes: volumes:
- db_data:/var/lib/postgresql/data - pgdb_data:/var/lib/postgresql/data
# - /etc/localtime:/etc/localtime:ro # - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro # - /etc/timezone:/etc/timezone:ro
uxbackend: backend:
image: uxbox-production-backend:latest image: uxbox-backend-production:latest
# container_name: uxbackend
restart: always restart: always
depends_on: depends_on:
- uxdb - pgdb
ports: ports:
- 6060 - 6060
volumes: volumes:
@ -67,12 +66,11 @@ services:
# Security setup # Security setup
- UXBOX_SECRET="foobar" - UXBOX_SECRET="foobar"
uxfrontend: frontend:
image: uxbox-production-frontend:latest image: uxbox-frontend-production:latest
#hostname: uxbox.io
restart: always restart: always
depends_on: depends_on:
- uxbackend - backend
ports: ports:
- 8080:8080 - 8080:8080
volumes: volumes:
@ -80,11 +78,11 @@ services:
# - /etc/localtime:/etc/localtime:ro # - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro # - /etc/timezone:/etc/timezone:ro
uxfrontend-dev: frontend-dev:
image: uxbox-develop-frontend:latest image: uxbox-frontend-develop:latest
restart: always restart: always
depends_on: depends_on:
- uxbackend - backend
ports: ports:
- 8081:8080 - 8081:8080
volumes: volumes:

View file

@ -6,6 +6,3 @@ npm ci
npm run dist:clean || exit 1; npm run dist:clean || exit 1;
npm run build:assets || exit 1; npm run build:assets || exit 1;
npm run build:all || exit 1; npm run build:all || exit 1;
# npm run build:main || exit 1;
# npm run build:view || exit 1;
# npm run build:worker || exit 1;

View file

@ -6,6 +6,3 @@ npm ci
npm run dist:clean || exit 1; npm run dist:clean || exit 1;
npm run dist:assets || exit 1; npm run dist:assets || exit 1;
npm run dist:all || exit 1; npm run dist:all || exit 1;
# npm run dist:main || exit 1;
# npm run dist:view || exit 1;
# npm run dist:worker || exit 1;

124
manage.sh
View file

@ -14,7 +14,7 @@ function remove-devenv-images {
docker images $IMGNAME -q | awk '{print $3}' | xargs --no-run-if-empty docker rmi docker images $IMGNAME -q | awk '{print $3}' | xargs --no-run-if-empty docker rmi
} }
function build-devenv { function build-devenv-image {
echo "Building development image $IMGNAME:$REV..." echo "Building development image $IMGNAME:$REV..."
docker build --rm=true \ docker build --rm=true \
-t $IMGNAME:$REV \ -t $IMGNAME:$REV \
@ -24,15 +24,15 @@ function build-devenv {
docker/devenv docker/devenv
} }
function build-devenv-if-not-exists { function build-devenv-image-if-not-exists {
if [[ ! $(docker images $IMGNAME:$REV -q) ]]; then if [[ ! $(docker images $IMGNAME:$REV -q) ]]; then
build-devenv build-devenv-image
fi fi
} }
function run-devenv { function run-devenv {
kill-devenv-container; kill-devenv-container;
build-devenv-if-not-exists; build-devenv-image-if-not-exists;
mkdir -p $HOME/.m2 mkdir -p $HOME/.m2
rm -rf ./frontend/node_modules rm -rf ./frontend/node_modules
@ -60,7 +60,7 @@ function run-all-tests {
} }
function run-frontend-tests { function run-frontend-tests {
build-devenv-if-not-exists; build-devenv-image-if-not-exists;
CONTAINER=$IMGNAME:latest CONTAINER=$IMGNAME:latest
@ -73,7 +73,7 @@ function run-frontend-tests {
} }
function run-backend-tests { function run-backend-tests {
build-devenv-if-not-exists; build-devenv-image-if-not-exists;
CONTAINER=$IMGNAME:latest CONTAINER=$IMGNAME:latest
@ -85,7 +85,7 @@ function run-backend-tests {
} }
function build-frontend-local { function build-frontend-local {
build-devenv-if-not-exists; build-devenv-image-if-not-exists;
mkdir -p $HOME/.m2 mkdir -p $HOME/.m2
rm -rf ./frontend/node_modules rm -rf ./frontend/node_modules
@ -103,34 +103,34 @@ function build-frontend-local {
$CONTAINER ./scripts/build-$BUILD_TYPE.sh $CONTAINER ./scripts/build-$BUILD_TYPE.sh
} }
function build-release-frontend-image { function build-frontend-production-image {
build-frontend-local "release" || exit 1; build-frontend-local "production" || exit 1;
rm -rf docker/release.frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/release.frontend/ || exit 1; cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \ docker build --rm=true \
-t uxbox-production-frontend:$REV \ -t uxbox-frontend-production:$REV \
-t uxbox-production-frontend:latest \ -t uxbox-frontend-production:latest \
docker/release.frontend/; docker/frontend/;
rm -rf docker/release.frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
} }
function build-develop-frontend-image { function build-frontend-develop-image {
build-frontend-local "develop" || exit 1; build-frontend-local "develop" || exit 1;
rm -rf docker/release.frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/release.frontend/ || exit 1; cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \ docker build --rm=true \
-t uxbox-develop-frontend:$REV \ -t uxbox-frontend-develop:$REV \
-t uxbox-develop-frontend:latest \ -t uxbox-frontend-develop:latest \
docker/release.frontend/; docker/frontend/;
rm -rf docker/release.frontend/dist || exit 1; rm -rf docker/frontend/dist || exit 1;
} }
function build-backend-local { function build-backend-local {
echo "Prepare backend release..." echo "Prepare backend dist..."
rm -rf ./backend/dist rm -rf ./backend/dist
@ -143,66 +143,66 @@ function build-backend-local {
./backend/ ./backend/dist/ ./backend/ ./backend/dist/
} }
function build-release-backend-image { function build-backend-production-image {
build-backend-local || exit 1; build-backend-local || exit 1;
rm -rf docker/release.backend/dist || exit 1; rm -rf docker/backend/dist || exit 1;
cp -vr backend/dist docker/release.backend/ || exit 1; cp -vr backend/dist docker/backend/ || exit 1;
docker build --rm=true \ docker build --rm=true \
-t uxbox-production-backend:$REV \ -t uxbox-backend-production:$REV \
-t uxbox-production-backend:latest \ -t uxbox-backend-production:latest \
docker/release.backend/; docker/backend/;
rm -rf docker/release.backend/dist || exit 1; rm -rf docker/backend/dist || exit 1;
} }
function build-images { function build-images {
echo "Building frontend release image ..." echo "Building frontend production image ..."
build-release-frontend-image || exit 1; build-frontend-production-image || exit 1;
echo "Building frontend develop image ..." echo "Building frontend develop image ..."
build-develop-frontend-image || exit 1; build-frontend-develop-image || exit 1;
echo "Building backend release image ..." echo "Building backend production image ..."
build-release-backend-image || exit 1; build-backend-production-image || exit 1;
} }
function run { function run {
if [[ ! $(docker images uxbox-release-backend:latest) ]]; then if [[ ! $(docker images uxbox-backend-production:latest) ]]; then
build-release-backend-image build-production-backend-image
fi fi
if [[ ! $(docker images uxbox-release-frontend:latest) ]]; then if [[ ! $(docker images uxbox-frontend-production:latest) ]]; then
build-release-frontend-image build-production-frontend-image
fi fi
if [[ ! $(docker images uxbox-develop-frontend:latest) ]]; then if [[ ! $(docker images uxbox-frontend-develop:latest) ]]; then
build-develop-frontend-image build-develop-frontend-image
fi fi
echo "Running production images..." echo "Running production images..."
sudo docker-compose -p uxbox -f ./docker/docker-compose.yml up -d docker-compose -p uxbox -f ./docker/docker-compose.yml up -d
} }
function stop { function stop {
echo "Stoping containers..." echo "Stoping containers..."
sudo docker-compose -p uxbox -f ./docker/docker-compose.yml stop -d docker-compose -p uxbox -f ./docker/docker-compose.yml stop
} }
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"
echo "Options:" echo "Options:"
echo "- clean Stop and clean up docker containers" echo "- clean Stop and clean up docker containers"
echo "- build-devenv Build docker container for development with tmux" echo "- build-devenv-image Build docker container for development with tmux"
echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)" echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)"
echo "- run-all-tests Execute unit tests for both backend and frontend" echo "- run-all-tests Execute unit tests for both backend and frontend"
echo "- run-frontend-tests Execute unit tests for frontend only" echo "- run-frontend-tests Execute unit tests for frontend only"
echo "- run-backend-tests Execute unit tests for backend only" echo "- run-backend-tests Execute unit tests for backend only"
echo "- build-release-images Build 'production ready' docker images for both backend and frontend" echo "- build-images Build a 'release ready' docker images for both backend and frontend"
echo "- build-develop-frontend-image Build a 'develop' docker images for frontend only" echo "- build-frontend-develop-image Build a 'release ready' docker image for frontend (develop build)"
echo "- build-release-frontend-image Build a 'production ready' docker images for frontend only" echo "- build-frontend-production-image Build a 'release ready' docker images for frontend"
echo "- build-release-backend-image Build a 'production ready' docker images for backend only" echo "- build-backend-production-image Build a 'release ready' docker images for backend"
echo "- run Run 'production ready' docker compose" echo "- run Run 'production ready' docker compose"
echo "- stop Stop 'production ready' docker compose" echo "- stop Stop 'production ready' docker compose"
} }
case $1 in case $1 in
@ -210,8 +210,8 @@ case $1 in
kill-devenv-container kill-devenv-container
remove-devenv-images remove-devenv-images
;; ;;
build-devenv) build-devenv-image)
build-devenv build-devenv-image
;; ;;
run-devenv) run-devenv)
run-devenv run-devenv
@ -229,14 +229,14 @@ case $1 in
build-images) build-images)
build-images build-images
;; ;;
build-release-frontend-image) build-frontend-develop-image)
build-release-frontend-image build-frontend-develop-image;
;; ;;
build-develop-frontend-image) build-frontend-production-image)
build-develop-frontend-image build-frontend-production-image;
;; ;;
build-release-backend-image) build-backend-production-image)
build-release-backend-image build-backend-production-image;
;; ;;
run) run)