Added docker config for server
This commit is contained in:
parent
d25c574444
commit
e83a1fda32
|
@ -1,4 +1,6 @@
|
||||||
FROM node
|
FROM alpine
|
||||||
|
|
||||||
|
RUN apk add --no-cache nodejs npm
|
||||||
|
|
||||||
ADD . /app
|
ADD . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
|
@ -59,3 +59,9 @@ await storage.get("key"); // => null
|
||||||
await storage.set("key", "value");
|
await storage.set("key", "value");
|
||||||
await storage.get("key"); // => "value"
|
await storage.get("key"); // => "value"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Run a server for remote storage:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm run storageserver
|
||||||
|
```
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
"dev:test": "jest --watchAll",
|
"dev:test": "jest --watchAll",
|
||||||
"dev:build": "microbundle watch -f modern,umd",
|
"dev:build": "microbundle watch -f modern,umd",
|
||||||
"storageserver": "ts-node src/server.ts",
|
"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",
|
"prepare": "npm run build",
|
||||||
"prepublishOnly": "npm test",
|
"prepublishOnly": "npm test",
|
||||||
"dev:serve": "live-server --host=localhost --port=5000 --no-browser --ignorePattern='.*\\.d\\.ts' dist"
|
"dev:serve": "live-server --host=localhost --port=5000 --no-browser --ignorePattern='.*\\.d\\.ts' dist"
|
||||||
|
|
|
@ -59,6 +59,6 @@ export function startRestServer(port: number, storage: KeyValueStorage): Promise
|
||||||
|
|
||||||
if (typeof require !== "undefined" && require.main === module) {
|
if (typeof require !== "undefined" && require.main === module) {
|
||||||
startRestServer(5001, getLocalStorage("tk-storage-server")).then(() => {
|
startRestServer(5001, getLocalStorage("tk-storage-server")).then(() => {
|
||||||
console.log(`Server running on port 5001`);
|
console.log(`Server running, use http://localhost:5001 to connect`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue