forked from kristjan/cjvt-valency
make frontend dev/prod ready
This commit is contained in:
parent
e5b6f02abd
commit
fbe9eb7b0f
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ data/samples/
|
|||
*egg-info/
|
||||
*.pyc
|
||||
src/frontend_vue/node_modules/
|
||||
src/frontend_vue/dist/
|
||||
|
|
10
Makefile
10
Makefile
|
@ -60,3 +60,13 @@ fill_database: data/samples
|
|||
--output $(OUTPUT) --outdir $(OUTDIR) --dbaddr $(DBADDR) \
|
||||
--dbuser $(DB_USR_USER) --dbpass $(DB_USR_PASS)
|
||||
|
||||
|
||||
## Frontend
|
||||
## Run from host
|
||||
## See src/frontend_vue/README.md for port settings etc.
|
||||
frontend-dev:
|
||||
cd src/frontend_vue/; $(MAKE) dev
|
||||
|
||||
frontend-prod:
|
||||
cd src/frontend_vue/; $(MAKE) prod
|
||||
|
||||
|
|
1
dockerfiles/frontend/README.md
Normal file
1
dockerfiles/frontend/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
# Files in `../../frontend_vue/`.
|
8
src/frontend_vue/Dockerfile
Normal file
8
src/frontend_vue/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM node:8-jessie
|
||||
|
||||
RUN npm install -g http-server
|
||||
|
||||
RUN mkdir /src
|
||||
WORKDIR /src
|
||||
|
||||
ENTRYPOINT ["/bin/bash"]
|
23
src/frontend_vue/Makefile
Normal file
23
src/frontend_vue/Makefile
Normal file
|
@ -0,0 +1,23 @@
|
|||
.PHONY: build-container dev prod info
|
||||
|
||||
IMGNAME = vue_vrontend
|
||||
CONNAME = vue-frontend
|
||||
|
||||
all: info
|
||||
|
||||
info:
|
||||
echo "Pick either dev or prod."
|
||||
|
||||
clean:
|
||||
- docker kill $(CONNAME)
|
||||
- docker rm $(CONNAME)
|
||||
|
||||
build-container:
|
||||
docker build . -t $(IMGNAME)
|
||||
|
||||
dev: build-container clean
|
||||
docker run --name $(CONNAME) -d -p 8080:8080 -v $(shell pwd):/src $(IMGNAME) /src/ops_scripts/alpine-dev.sh
|
||||
|
||||
prod: build-container clean
|
||||
docker run --name $(CONNAME) -d -p 8080:8080 -v $(shell pwd):/src $(IMGNAME) /src/ops_scripts/alpine-prod.sh
|
||||
|
|
@ -1,21 +1,29 @@
|
|||
# vue_frontend
|
||||
# frontend_vue
|
||||
|
||||
> Frontend for Valency App.
|
||||
Frontend for Valency App.
|
||||
|
||||
## Build Setup
|
||||
## Quick build
|
||||
(Docker container)
|
||||
```bash
|
||||
$ make dev
|
||||
$ make prod
|
||||
```
|
||||
|
||||
## Manual build
|
||||
|
||||
Manually edit files: `./config/config_{dev,prod}.json` to point to the right API address.
|
||||
|
||||
``` bash
|
||||
# install dependencies
|
||||
npm install
|
||||
$ npm install
|
||||
|
||||
# serve with hot reload at localhost:8080
|
||||
npm run dev
|
||||
$ npm run dev
|
||||
|
||||
# build for production with minification
|
||||
npm run build
|
||||
$ npm run build
|
||||
|
||||
# build for production and view the bundle analyzer report
|
||||
npm run build --report
|
||||
$ npm run build --report
|
||||
```
|
||||
|
||||
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
||||
|
|
6
src/frontend_vue/ops_scripts/dev.sh
Executable file
6
src/frontend_vue/ops_scripts/dev.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
cp ./config/config_dev.json ./config/config.json
|
||||
|
||||
npm install
|
||||
npm run dev
|
7
src/frontend_vue/ops_scripts/prod.sh
Executable file
7
src/frontend_vue/ops_scripts/prod.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
cp ./config/config_prod.json ./config/config.json
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
http-server /src/dist
|
415
src/frontend_vue/package-lock.json
generated
415
src/frontend_vue/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user