From 656a247dbe8e5f50fc33297ef3a7e6eae97e85e0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 23 Jan 2023 10:05:16 +0000 Subject: [PATCH] Fix image and move folders --- hosting/{tests => dependencies}/Dockerfile | 2 +- hosting/dependencies/README.md | 57 +++++++++++++++++++ .../jest-testcontainers-config.js | 0 hosting/{tests => dependencies}/runner.sh | 0 package.json | 7 ++- 5 files changed, 62 insertions(+), 4 deletions(-) rename hosting/{tests => dependencies}/Dockerfile (92%) create mode 100644 hosting/dependencies/README.md rename hosting/{tests => dependencies}/jest-testcontainers-config.js (100%) rename hosting/{tests => dependencies}/runner.sh (100%) diff --git a/hosting/tests/Dockerfile b/hosting/dependencies/Dockerfile similarity index 92% rename from hosting/tests/Dockerfile rename to hosting/dependencies/Dockerfile index c39cb62931..eb35c19847 100644 --- a/hosting/tests/Dockerfile +++ b/hosting/dependencies/Dockerfile @@ -12,7 +12,7 @@ RUN chmod +x install.sh && ./install.sh WORKDIR / -ADD tests/runner.sh . +ADD hosting/tests/runner.sh . RUN chmod +x ./runner.sh EXPOSE 5984 diff --git a/hosting/dependencies/README.md b/hosting/dependencies/README.md new file mode 100644 index 0000000000..ccfc386ea5 --- /dev/null +++ b/hosting/dependencies/README.md @@ -0,0 +1,57 @@ +# Docker Image for Running Budibase Tests + +## Overview +This image contains the basic setup for running + +## Usage + +- Build the Image +- Run the Container + + +### Build the Image +The guidance below is based on building the Budibase single image on Debian 11 and AlmaLinux 8. If you use another distro or OS you will need to amend the commands to suit. +#### Install Node +Budibase requires a more recent version of node (14+) than is available in the base Debian repos so: + +``` +curl -sL https://deb.nodesource.com/setup_16.x | sudo bash - +apt install -y nodejs +node -v +``` +Install yarn and lerna: +``` +npm install -g yarn jest lerna +``` +#### Install Docker + +``` +apt install -y docker.io +``` + +Check the versions of each installed version. This process was tested with the version numbers below so YMMV using anything else: + +- Docker: 20.10.5 +- node: 16.15.1 +- yarn: 1.22.19 +- lerna: 5.1.4 + +#### Get the Code +Clone the Budibase repo +``` +git clone https://github.com/Budibase/budibase.git +cd budibase +``` +#### Setup Node +Node setup: +``` +node ./hosting/scripts/setup.js +yarn +yarn bootstrap +yarn build +``` +#### Build Image +The following yarn command does some prep and then runs the docker build command: +``` +yarn build:docker:tests +``` diff --git a/hosting/tests/jest-testcontainers-config.js b/hosting/dependencies/jest-testcontainers-config.js similarity index 100% rename from hosting/tests/jest-testcontainers-config.js rename to hosting/dependencies/jest-testcontainers-config.js diff --git a/hosting/tests/runner.sh b/hosting/dependencies/runner.sh similarity index 100% rename from hosting/tests/runner.sh rename to hosting/dependencies/runner.sh diff --git a/package.json b/package.json index dca639102c..6b509ccf84 100644 --- a/package.json +++ b/package.json @@ -66,8 +66,9 @@ "build:docker:single:multiarch": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/single/Dockerfile -t budibase:latest .", "build:docker:single:image": "docker build -f hosting/single/Dockerfile -t budibase:latest .", "build:docker:single": "npm run build:docker:pre && npm run build:docker:single:image", - "build:docker:couch": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/couchdb/Dockerfile -t budibase/couchdb:latest -t budibase/couchdb:v3.2.1 --push ./hosting/couchdb", - "build:docker:tests": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/tests/Dockerfile -t budibase/tests:latest -t budibase/tests:v3.2.1 --push ./hosting", + "build:docker:tests": "docker build -f hosting/tests/Dockerfile -t budibase/tests:local .", + "publish:docker:couch": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/couchdb/Dockerfile -t budibase/couchdb:latest -t budibase/couchdb:v3.2.1 --push ./hosting/couchdb", + "publish:docker:tests": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/tests/Dockerfile -t budibase/tests:latest -t budibase/tests:v3.2.1 --push ./hosting", "build:docs": "lerna run build:docs", "release:helm": "node scripts/releaseHelmChart", "env:multi:enable": "lerna run env:multi:enable", @@ -86,4 +87,4 @@ "install:pro": "bash scripts/pro/install.sh", "dep:clean": "yarn clean && yarn bootstrap" } -} +} \ No newline at end of file