Use nx/esbuild for worker docker & dev
This commit is contained in:
parent
37df172ba6
commit
f27c4ae55a
|
@ -29,8 +29,8 @@ services:
|
|||
depends_on:
|
||||
- worker-service
|
||||
- redis-service
|
||||
# volumes:
|
||||
# - /some/path/to/plugins:/plugins
|
||||
# volumes:
|
||||
# - /some/path/to/plugins:/plugins
|
||||
|
||||
worker-service:
|
||||
build: ../packages/worker
|
||||
|
|
10
package.json
10
package.json
|
@ -3,7 +3,10 @@
|
|||
"private": true,
|
||||
"devDependencies": {
|
||||
"@esbuild-plugins/node-resolve": "^0.2.2",
|
||||
"@nx/esbuild": "^16.2.1",
|
||||
"@nx/js": "16.2.1",
|
||||
"@rollup/plugin-json": "^4.0.2",
|
||||
"@types/node": "18.7.1",
|
||||
"@typescript-eslint/parser": "5.45.0",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"esbuild": "^0.17.18",
|
||||
|
@ -13,10 +16,10 @@
|
|||
"husky": "^8.0.3",
|
||||
"js-yaml": "^4.1.0",
|
||||
"kill-port": "^1.6.1",
|
||||
"lerna": "^6.6.1",
|
||||
"lerna": "^6.6.2",
|
||||
"madge": "^6.0.0",
|
||||
"minimist": "^1.2.8",
|
||||
"prettier": "^2.3.1",
|
||||
"prettier": "^2.6.2",
|
||||
"prettier-plugin-svelte": "^2.3.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup-plugin-replace": "^2.2.0",
|
||||
|
@ -105,5 +108,6 @@
|
|||
"packages/worker",
|
||||
"packages/pro/packages/pro"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -328,8 +328,8 @@ export const runLuceneQuery = (docs: any[], query?: Query) => {
|
|||
return (
|
||||
docValue == null ||
|
||||
docValue === "" ||
|
||||
docValue < testValue.low ||
|
||||
docValue > testValue.high
|
||||
+docValue < testValue.low ||
|
||||
+docValue > testValue.high
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
@ -7,16 +7,18 @@ LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-ho
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# copy required files
|
||||
COPY . ./
|
||||
|
||||
# handle node-gyp
|
||||
RUN apk add --no-cache --virtual .gyp python3 make g++ \
|
||||
&& yarn && apk del .gyp \
|
||||
&& yarn \
|
||||
&& yarn cache clean
|
||||
RUN apk add --no-cache --virtual .gyp python3 make g++
|
||||
RUN yarn global add pm2
|
||||
|
||||
|
||||
COPY dist/package.json .
|
||||
RUN yarn
|
||||
RUN apk del .gyp \
|
||||
&& yarn cache clean
|
||||
|
||||
COPY dist/ .
|
||||
|
||||
EXPOSE 4001
|
||||
|
||||
# have to add node environment production after install
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
"src/**/*.spec.js",
|
||||
"../backend-core/dist/**/*"
|
||||
],
|
||||
"exec": "node ../../scripts/build && node ./dist/index.js"
|
||||
"exec": "yarn build && node dist/index.cjs"
|
||||
}
|
||||
|
|
|
@ -13,12 +13,11 @@
|
|||
],
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist/",
|
||||
"build": "node ../../scripts/build.js",
|
||||
"build": "cd ../.. && nx build @budibase/worker",
|
||||
"check:types": "tsc -p tsconfig.build.json --noEmit",
|
||||
"postbuild": "copyfiles -u 1 src/**/*.hbs dist/",
|
||||
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
||||
"run:docker": "node dist/index.js",
|
||||
"debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js",
|
||||
"run:docker": "node index.cjs",
|
||||
"debug": "yarn build && node --expose-gc --inspect=9223 dist/index.cjs",
|
||||
"run:docker:cluster": "pm2-runtime start pm2.config.js",
|
||||
"predocker": "yarn build",
|
||||
"build:docker": "yarn predocker && docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION",
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/esbuild:esbuild",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"defaultConfiguration": "production",
|
||||
"options": {
|
||||
"main": "packages/worker/src/index.ts",
|
||||
"outputPath": "packages/worker/dist",
|
||||
"outputFileName": "index.js",
|
||||
"tsConfig": "packages/worker/tsconfig.build.json",
|
||||
"assets": [
|
||||
"packages/worker/docker_run.sh",
|
||||
{
|
||||
"glob": "**/*.hbs",
|
||||
"input": "packages/worker/src/constants/templates",
|
||||
"output": "."
|
||||
}
|
||||
],
|
||||
"format": ["cjs"]
|
||||
},
|
||||
"configurations": {
|
||||
"development": {
|
||||
"minify": false
|
||||
},
|
||||
"production": {
|
||||
"minify": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue