From e83a1fda3201a431eb690d77e98e21fd89647acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 27 Nov 2019 23:31:00 +0100 Subject: [PATCH] Added docker config for server --- Dockerfile | 4 +++- README.md | 6 ++++++ package.json | 4 ++++ src/server.ts | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48662aa..b8de36f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM node +FROM alpine + +RUN apk add --no-cache nodejs npm ADD . /app WORKDIR /app diff --git a/README.md b/README.md index 1afa7da..114e3e7 100644 --- a/README.md +++ b/README.md @@ -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 +``` diff --git a/package.json b/package.json index 7c6bbc2..7789651 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/server.ts b/src/server.ts index 7d137bf..19b7b40 100644 --- a/src/server.ts +++ b/src/server.ts @@ -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`); }); }