From a9fbe4cdb4fce559cc0042ed87c098ca9e49d6ef Mon Sep 17 00:00:00 2001 From: zhaoyingbo Date: Fri, 9 Aug 2024 08:03:52 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/miflow.yml | 2 ++ Dockerfile | 13 ------------- docker-compose.yml | 9 --------- docker/Dockerfile | 15 +++++++++++++++ service/gitlab/mr.ts | 20 ++++++++++++++++++++ 5 files changed, 37 insertions(+), 22 deletions(-) delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100644 service/gitlab/mr.ts diff --git a/.gitea/workflows/miflow.yml b/.gitea/workflows/miflow.yml index 11f6585..35d7ac1 100644 --- a/.gitea/workflows/miflow.yml +++ b/.gitea/workflows/miflow.yml @@ -24,5 +24,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v4 with: + context: . + file: docker/Dockerfile push: true tags: micr.cloud.mioffice.cn/egg/gitlab_monitor:${{ github.sha }} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 90e78e6..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM micr.cloud.mioffice.cn/zhaoyingbo/bun:alpine-cn - -WORKDIR /app - -COPY package*.json ./ - -COPY bun.lockb ./ - -RUN bun install - -COPY . . - -CMD ["bun", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 36686d7..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: "3" - -services: - gitlab_monitor: - image: git.yingbo.im:333/zhaoyingbo/gitlab_monitor:sha - container_name: gitlab_monitor - restart: always - ports: - - 3001:3000 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..7a62828 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,15 @@ +FROM oven/bun:1-alpine + +RUN /bin/sh -c apk update && apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone + +WORKDIR /app + +COPY package*.json ./ + +COPY bun.lockb ./ + +RUN bun install + +COPY . . + +CMD ["bun", "start"] \ No newline at end of file diff --git a/service/gitlab/mr.ts b/service/gitlab/mr.ts new file mode 100644 index 0000000..108e905 --- /dev/null +++ b/service/gitlab/mr.ts @@ -0,0 +1,20 @@ +import netTool from "../netTool" +import { GITLAB_AUTH_HEADER, GITLAB_BASE_URL, gitlabReqWarp } from "./tools" + +const getDiffs = async (project_id: number, merge_request_iid: number) => { + const URL = `${GITLAB_BASE_URL}/projects/${project_id}/merge_requests/${merge_request_iid}/changes` + const res = await gitlabReqWarp( + () => netTool.get(URL, {}, GITLAB_AUTH_HEADER), + null + ) + if (res === null) return null + return res +} + +const mr = { + getDiffs, +} + +export default mr + +getDiffs(139032, 484).then(console.log)