Skip to content

Commit

Permalink
feat: 升级插件构建
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 3388
  • Loading branch information
liangling0628 committed Mar 6, 2024
1 parent 38b1dfe commit c28528b
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

node_modules/

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Compiled binary addons (https://nodejs.org/api/addons.html)
dist/
artifacts/
work/
ci/
e2e-results/
**/cypress/videos
**/cypress/report.json

# Editor
.idea

.eslintcache
.codecc
.vscode

pre-*-bkcodeai
2 changes: 0 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module.exports = {
arrowParens: 'always',
arrowParens: 'avoid',
bracketSameLine: false,
jsxSingleQuote: true,
printWidth: 120,
quoteProps: 'as-needed',
quoteProps: 'as-needed',
semi: true,
singleAttributePerLine: true,
singleQuote: true,
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ARG NODE_IMAGE=node:20.11.1-slim
ARG PNPM_VERSION=8
ARG NODE_PLATFORM=linux/amd64

FROM --platform=${NODE_PLATFORM} ${NODE_IMAGE} as nodejs

WORKDIR /code

RUN npm i -g pnpm@${PNPM_VERSION}

COPY . .

RUN pnpm i
RUN pnpm run build
RUN tar -czvf frontend.tar.gz src/alert/dist src/event/dist src/timeseries/dist

CMD [ "echo", "前端构建完毕" ]
17 changes: 17 additions & 0 deletions docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e

# 默认为./build
target=${1:-./build}

rm -rf ./build

docker build -t bkmonitor_plugin_build .

docker run -d --name plugin-temp-container bkmonitor_plugin_build

mkdir -p "$target"

docker cp plugin-temp-container:/code/frontend.tar.gz "$target"

docker rm plugin-temp-container

2 changes: 2 additions & 0 deletions src/timeseries/src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"id": "bkmonitor-timeseries-datasource",
"metrics": true,
"annotations": false,
"alerting": true,
"mixed": true,
"queryOptions": {
"maxDataPoints": true
},
Expand Down

0 comments on commit c28528b

Please sign in to comment.