make frontend dev/prod ready

This commit is contained in:
voje 2019-03-19 08:11:26 +01:00
parent e5b6f02abd
commit fbe9eb7b0f
11 changed files with 281 additions and 214 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ data/samples/
*egg-info/ *egg-info/
*.pyc *.pyc
src/frontend_vue/node_modules/ src/frontend_vue/node_modules/
src/frontend_vue/dist/

View File

@ -60,3 +60,13 @@ fill_database: data/samples
--output $(OUTPUT) --outdir $(OUTDIR) --dbaddr $(DBADDR) \ --output $(OUTPUT) --outdir $(OUTDIR) --dbaddr $(DBADDR) \
--dbuser $(DB_USR_USER) --dbpass $(DB_USR_PASS) --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

View File

@ -0,0 +1 @@
# Files in `../../frontend_vue/`.

View 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
View 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

View File

@ -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 ``` bash
# install dependencies # install dependencies
npm install $ npm install
# serve with hot reload at localhost:8080 # serve with hot reload at localhost:8080
npm run dev $ npm run dev
# build for production with minification # build for production with minification
npm run build $ npm run build
# build for production and view the bundle analyzer report # 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).

View File

@ -0,0 +1,6 @@
#!/bin/bash
cp ./config/config_dev.json ./config/config.json
npm install
npm run dev

View File

@ -0,0 +1,7 @@
#!/bin/bash
cp ./config/config_prod.json ./config/config.json
npm install
npm run build
http-server /src/dist

File diff suppressed because it is too large Load Diff