[demo] Dockerize prod (#42)
* simulation/news: Change test to make a DATE recognized.
This commit is contained in:
Родитель
99e1441764
Коммит
6543bc62d8
|
@ -1,7 +1,32 @@
|
|||
.git/
|
||||
.vscode/
|
||||
|
||||
**/README.md
|
||||
**/*.Dockerfile
|
||||
**/Dockerfile
|
||||
|
||||
client/build/
|
||||
|
||||
# DB
|
||||
db.sqlite
|
||||
|
||||
# Libraries
|
||||
**/SafeMath.sol
|
||||
**/SignedSafeMath.sol
|
||||
|
||||
blockchain_db/
|
||||
|
||||
node_modules/
|
||||
client/node_modules/
|
||||
|
||||
# Generated contract configs
|
||||
client/src/contracts/*.json
|
||||
|
||||
# Training
|
||||
**/embedding_cache.json
|
||||
**/*.zip
|
||||
client/src/ml-models/hot_dog-not/seefood/
|
||||
|
||||
client/coverage/
|
||||
|
||||
**/*~
|
|
@ -33,7 +33,7 @@ pids
|
|||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
coverage/
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "bash deploy_client.sh",
|
||||
"start-prod": "bash start_prod.sh",
|
||||
"build": "react-scripts build",
|
||||
"test": "bash test.sh",
|
||||
"train-vpa-classifier": "node src/ml-models/vpa/train-classifier.js",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Start the production front-end.
|
||||
|
||||
set -ex
|
||||
|
||||
if [ -z ${PORT+x} ]; then
|
||||
PORT=3000
|
||||
fi
|
||||
|
||||
serve --single --listen ${PORT} build
|
|
@ -4,11 +4,13 @@
|
|||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"blockchain": "mkdir --parents blockchain_db && ganache-cli --db blockchain_db --networkId 5782 --gasLimit 9000000 --gasPrice 1 --host 0.0.0.0 --port 7545 --mnemonic \"net pistol fun vibrant sausage vintage general silk weekend street brave rubber\"",
|
||||
"blockchain": "mkdir --parents blockchain_db && ganache-cli --db blockchain_db --networkId 5782 --gasLimit 9000000 --gasPrice 1 --host 0.0.0.0 --port ${PORT:-7545} --mnemonic \"net pistol fun vibrant sausage vintage general silk weekend street brave rubber\"",
|
||||
"clean": "rm -rf blockchain_db db.sqlite client/src/contracts/*.json",
|
||||
"client": "cd client && yarn start",
|
||||
"prod-client": "cd client && yarn start-prod",
|
||||
"lint": "solium --dir client/contracts/ --fix-dry-run",
|
||||
"server": "nodemon server.js --ignore client/",
|
||||
"start-prod-back-end": "node server.js",
|
||||
"test": "cd client && yarn test"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# For deployment to an Azure Web Service
|
||||
# Build with: docker image build --file service.Dockerfile --tag decai-demo-prod .
|
||||
FROM appsvc/node:10-lts
|
||||
|
||||
LABEL maintainer="Justin D. Harris (justin.harris@microsoft.com)"
|
||||
|
||||
WORKDIR /root/workspace/demo
|
||||
|
||||
RUN apt-get update && apt-get install --fix-missing --yes build-essential git locales locales-all
|
||||
|
||||
COPY client ./client
|
||||
COPY package.json server.js setup.sh setup_libs.sh yarn.lock ./
|
||||
|
||||
RUN bash setup.sh
|
||||
|
||||
# Override the port the blockchain uses (just for this command).
|
||||
# Test also builds the contracts.
|
||||
RUN cd client && PORT=7545 yarn test && yarn build
|
|
@ -25,6 +25,6 @@ class TestNewsDataLoader(unittest.TestCase):
|
|||
(x_train, y_train), (x_test, y_test) = self.data_loader.load_data()
|
||||
|
||||
def test_entities(self):
|
||||
doc = self.data_loader._nlp("Today, John Smith walked to a store and bought an apple.")
|
||||
doc = self.data_loader._nlp("December 25, 2019, John Smith walked to a store and bought an apple.")
|
||||
actual = self.data_loader._replace_entities(doc)
|
||||
self.assertEqual("<DATE>, <PERSON> walked to a store and bought an apple.", actual)
|
||||
|
|
Загрузка…
Ссылка в новой задаче