Added docker config for server

This commit is contained in:
Michaël Lemaire 2019-11-27 23:31:00 +01:00
parent d25c574444
commit e83a1fda32
4 changed files with 14 additions and 2 deletions

View file

@ -1,4 +1,6 @@
FROM node
FROM alpine
RUN apk add --no-cache nodejs npm
ADD . /app
WORKDIR /app

View file

@ -59,3 +59,9 @@ await storage.get("key"); // => null
await storage.set("key", "value");
await storage.get("key"); // => "value"
```
Run a server for remote storage:
```shell
npm run storageserver
```

View file

@ -14,6 +14,10 @@
"dev:test": "jest --watchAll",
"dev:build": "microbundle watch -f modern,umd",
"storageserver": "ts-node src/server.ts",
"docker:build": "docker build -t thunderk/tk-storage .",
"docker:push": "docker push thunderk/tk-storage",
"docker:run": "docker run -it --rm thunderk/tk-storage",
"docker:publish": "run-s docker:build docker:push",
"prepare": "npm run build",
"prepublishOnly": "npm test",
"dev:serve": "live-server --host=localhost --port=5000 --no-browser --ignorePattern='.*\\.d\\.ts' dist"

View file

@ -59,6 +59,6 @@ export function startRestServer(port: number, storage: KeyValueStorage): Promise
if (typeof require !== "undefined" && require.main === module) {
startRestServer(5001, getLocalStorage("tk-storage-server")).then(() => {
console.log(`Server running on port 5001`);
console.log(`Server running, use http://localhost:5001 to connect`);
});
}