From bfd846e9a4571c9d3219e9137f86b812b6e0d2ef Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 19 May 2023 16:26:34 +0200 Subject: [PATCH] Dockerise server --- packages/server/.dockerignore | 25 +++++-------------------- packages/server/Dockerfile | 18 +++++++++++------- packages/server/package.json | 2 +- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/packages/server/.dockerignore b/packages/server/.dockerignore index 3bb9f9f5b8..3e7ee31bbd 100644 --- a/packages/server/.dockerignore +++ b/packages/server/.dockerignore @@ -1,20 +1,5 @@ -node_modules -npm-debug.log -Dockerfile -src -.dockerignore -.git -.gitignore -.yarnrc -.vscode -.idea -.env -__mocks__ -yarn-error.log -jest.config.ts -jest-testcontainers-config.js -LICENSE -nodemon.json -tsconfig.build.json -tsconfig.json -coverage +* +!/dist/ +!/scripts/integrations/oracle/ +!/package.json +!/docker_run.sh \ No newline at end of file diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index da6f34a91f..f3ca43777b 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -15,22 +15,26 @@ ENV POSTHOG_TOKEN=phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU ENV TENANT_FEATURE_FLAGS=*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR ENV ACCOUNT_PORTAL_URL=https://account.budibase.app -# copy required files -COPY . ./ # handle node-gyp RUN apt-get update \ - && apt-get install -y --no-install-recommends g++ make python \ - && yarn \ - && yarn cache clean \ - && apt-get remove -y --purge --auto-remove g++ make python \ - && rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp + && apt-get install -y --no-install-recommends g++ make python RUN yarn global add pm2 # Install client for oracle datasource RUN apt-get install unzip libaio1 +COPY scripts/integrations/oracle/ scripts/integrations/oracle/ RUN /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh +COPY package.json . +RUN yarn \ + && yarn cache clean +RUN apt-get remove -y --purge --auto-remove g++ make python \ + && rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp + +COPY dist/ . +COPY docker_run.sh . + EXPOSE 4001 # have to add node environment production after install diff --git a/packages/server/package.json b/packages/server/package.json index 472bc96eb8..60ab2ec534 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -20,7 +20,7 @@ "predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client && yarn build", "build:docker": "yarn predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION", "build:docs": "node ./scripts/docs/generate.js open", - "run:docker": "node dist/index.js", + "run:docker": "node index.js", "run:docker:cluster": "pm2-runtime start pm2.config.js", "dev:stack:up": "node scripts/dev/manage.js up", "dev:stack:down": "node scripts/dev/manage.js down",