From 594b7c2cce66d7a4e868a075e1bf773b5e7f7fa6 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 15 Jun 2020 17:06:54 +0100 Subject: [PATCH] budibase dockerfile --- packages/server/Dockerfile | 11 +++++++++++ packages/server/package.json | 1 + packages/server/src/index.js | 13 +++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 packages/server/Dockerfile create mode 100644 packages/server/src/index.js diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile new file mode 100644 index 0000000000..7ae24dfd62 --- /dev/null +++ b/packages/server/Dockerfile @@ -0,0 +1,11 @@ +FROM node:12-alpine + +WORKDIR /app + +# copy files and install dependencies +COPY . ./ +RUN yarn + +EXPOSE 4001 + +CMD ["yarn", "run:docker"] diff --git a/packages/server/package.json b/packages/server/package.json index 49a5626f6f..ad89654b0e 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -27,6 +27,7 @@ "test:integration": "jest workflow --runInBand", "test:watch": "jest --watch", "initialise": "node ../cli/bin/budi init -b local -q", + "run:docker": "node src/index", "budi": "node ../cli/bin/budi", "dev:builder": "nodemon ../cli/bin/budi run", "electron": "electron src/electron.js", diff --git a/packages/server/src/index.js b/packages/server/src/index.js new file mode 100644 index 0000000000..89f61d2f22 --- /dev/null +++ b/packages/server/src/index.js @@ -0,0 +1,13 @@ +const { resolve } = require("path") + +async function runServer() { + const budibaseDir = "~/.budibase"; + + process.env.BUDIBASE_DIR = resolve(budibaseDir) + + const server = await require("./app")(); + server.on("close", () => console.log("Server Closed")) + console.log(`Budibase running on ${JSON.stringify(server.address())}`) +} + +runServer(); \ No newline at end of file