Updating Dockerfiles and dockerignore to clear out any un-needed assets.

This commit is contained in:
mike12345567 2023-04-26 17:59:18 +01:00
parent 49b45f5e67
commit 5066d20c9d
7 changed files with 48 additions and 13 deletions

View File

@ -1,6 +1,20 @@
node_modules node_modules
npm-debug.log npm-debug.log
Dockerfile Dockerfile
src
.dockerignore .dockerignore
.git .git
.gitignore .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

View File

@ -15,8 +15,8 @@ ENV POSTHOG_TOKEN=phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU
ENV TENANT_FEATURE_FLAGS=*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR ENV TENANT_FEATURE_FLAGS=*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR
ENV ACCOUNT_PORTAL_URL=https://account.budibase.app ENV ACCOUNT_PORTAL_URL=https://account.budibase.app
# copy files and install dependencies # copy required files
COPY package.json dist specs client build builder docker_run.sh pm2.config.js ./ COPY . ./
# handle node-gyp # handle node-gyp
RUN apt-get update \ RUN apt-get update \
@ -24,9 +24,9 @@ RUN apt-get update \
&& yarn \ && yarn \
&& yarn cache clean \ && yarn cache clean \
&& apt-get remove -y --purge --auto-remove g++ make python \ && 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 && rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp \
&& rm -rf node_modules/@budibase
RUN yarn global add pm2 RUN yarn global add pm2
RUN yarn
# Install client for oracle datasource # Install client for oracle datasource
RUN apt-get install unzip libaio1 RUN apt-get install unzip libaio1

View File

@ -10,16 +10,16 @@
}, },
"scripts": { "scripts": {
"prebuild": "rimraf dist/", "prebuild": "rimraf dist/",
"build": "tsc -p tsconfig.build.json && mv dist/src/* dist/ && rimraf dist/src/", "build": "../../scripts/build.js",
"esbuild": "../../scripts/build.js", "tsbuild": "tsc -p tsconfig.build.json && mv dist/src/* dist/ && rimraf dist/src/",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js", "debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js",
"postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/", "postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/",
"test": "bash scripts/test.sh", "test": "bash scripts/test.sh",
"test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit", "test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client", "predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client && yarn build",
"build:docker": "yarn run predocker && yarn run esbuild && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION", "build:docker": "yarn predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION",
"build:docs": "node ./scripts/docs/generate.js open", "build:docs": "node ./scripts/docs/generate.js open",
"run:docker": "node dist/index.js", "run:docker": "node dist/index.js",
"run:docker:cluster": "pm2-runtime start pm2.config.js", "run:docker:cluster": "pm2-runtime start pm2.config.js",

View File

@ -103,6 +103,8 @@ const environment = {
}, },
} }
console.log(environment)
// threading can cause memory issues with node-ts in development // threading can cause memory issues with node-ts in development
if (isDev() && environment.DISABLE_THREADING == null) { if (isDev() && environment.DISABLE_THREADING == null) {
environment._set("DISABLE_THREADING", "1") environment._set("DISABLE_THREADING", "1")

View File

@ -1,7 +1,20 @@
node_modules node_modules
npm-debug.log npm-debug.log
Dockerfile Dockerfile
src
.dockerignore .dockerignore
.git .git
.gitignore .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

View File

@ -7,11 +7,15 @@ LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-ho
WORKDIR /app WORKDIR /app
# copy files and install dependencies # copy required files
COPY . ./ COPY . ./
# handle node-gyp # handle node-gyp
RUN apk add --no-cache --virtual .gyp python3 make g++ \ RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& yarn && apk del .gyp && yarn && apk del .gyp \
&& yarn \
&& yarn cache clean \
&& rm -rf node_modules/@budibase
RUN yarn global add pm2 RUN yarn global add pm2
EXPOSE 4001 EXPOSE 4001

View File

@ -13,13 +13,15 @@
], ],
"scripts": { "scripts": {
"prebuild": "rimraf dist/", "prebuild": "rimraf dist/",
"build": "tsc -p tsconfig.build.json", "build": "../../scripts/build.js",
"tsbuild": "tsc -p tsconfig.build.json",
"postbuild": "copyfiles -u 1 src/**/*.hbs dist/", "postbuild": "copyfiles -u 1 src/**/*.hbs dist/",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"run:docker": "node dist/index.js", "run:docker": "node dist/index.js",
"debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js", "debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js",
"run:docker:cluster": "pm2-runtime start pm2.config.js", "run:docker:cluster": "pm2-runtime start pm2.config.js",
"build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION", "predocker": "yarn build",
"build:docker": "yarn predocker && docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION",
"dev:stack:init": "node ./scripts/dev/manage.js init", "dev:stack:init": "node ./scripts/dev/manage.js init",
"dev:builder": "npm run dev:stack:init && rimraf dist/ && nodemon", "dev:builder": "npm run dev:stack:init && rimraf dist/ && nodemon",
"dev:built": "yarn run dev:stack:init && yarn run run:docker", "dev:built": "yarn run dev:stack:init && yarn run run:docker",