Update ui-v2 makefile to handle updating node_modules when needed

Also dont include the dist and node_modules folders in the build context.
This commit is contained in:
Matt Keeler 2018-06-19 13:51:49 -04:00
parent 2d863b8d4c
commit 5c9275c60b
3 changed files with 24 additions and 29 deletions

View File

@ -11,4 +11,4 @@ RUN apk update && \
mkdir /consul-src
WORKDIR /consul-src
CMD make init build
CMD make

View File

@ -68,7 +68,7 @@ function build_ui {
then
status "Copying the source from '${ui_dir}' to /consul-src within the container"
(
docker cp . ${container_id}:/consul-src &&
tar -c $(ls | grep -v "^(node_modules\|dist)") | docker cp - ${container_id}:/consul-src &&
status "Running build in container" && docker start -i ${container_id} &&
rm -rf ${1}/ui-v2/dist &&
status "Copying back artifacts" && docker cp ${container_id}:/consul-src/dist ${1}/ui-v2/dist

View File

@ -1,33 +1,28 @@
ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
server:
yarn run start
dist:
all: build
deps: node_modules
build: deps
yarn run build
mv dist ../pkg/web_ui/v2
init:
yarn install
lint:
yarn run lint:js
format:
yarn run format:js
.PHONY: server dist lint format
.DEFAULT_GOAL=all
.PHONY: deps test all build start
all: deps
deps: node_modules yarn.lock package.json
node_modules:
yarn
build:
yarn run build
start:
start: deps
yarn run start
test:
test: deps
yarn run test
test-view:
test-view: deps
yarn run test:view
lint: deps
yarn run lint:js
format: deps
yarn run format:js
node_modules: yarn.lock package.json
yarn install
.PHONY: all deps build start test test-view lint format