Skip to content

Commit

Permalink
[migrate] replace Crawler controller with idea2app/Web-file-cache ser…
Browse files Browse the repository at this point in the history
…vice

[optimize] update Upstream packages

Signed-off-by: TechQuery <shiy2008@gmail.com>
  • Loading branch information
TechQuery committed Dec 28, 2024
1 parent 5b4a77b commit da90b4e
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 1,517 deletions.
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
# Reference: https://pnpm.io/docker#example-1-build-a-bundle-in-a-docker-container

FROM ghcr.io/puppeteer/puppeteer:latest AS base
USER root
FROM node:20-slim AS base
RUN apt-get update && \
apt-get install curl -y --no-install-recommends
RUN mv ~/.cache/puppeteer/chrome /opt/chromium
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN mkdir /app
COPY . /app
WORKDIR /app
COPY . .

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --prod --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i -P --frozen-lockfile --ignore-scripts

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile
RUN pnpm build

FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist

COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
EXPOSE 8080
CMD ["npm", "start"]
36 changes: 17 additions & 19 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

### Production environment

- Entry: https://service.kaiyuanshe.cn/
- Document: https://service.kaiyuanshe.cn/docs/
- Schema: https://service.kaiyuanshe.cn/docs/spec/
- Entry: https://service.kaiyuanshe.cn/
- Document: https://service.kaiyuanshe.cn/docs/
- Schema: https://service.kaiyuanshe.cn/docs/spec/

### Type package

Expand All @@ -42,19 +42,18 @@ pnpm i @kaiyuanshe/kys-service -D

## Environment variables

| Name | Usage |
| :---------------------: | :---------------------------------------: |
| `DATABASE_URL` | [PostgreSQL][11] connection string |
| `APP_SECRET` | encrypt Password & Token |
| `WEB_HOOK_TOKEN` | `Authorization` token of Custom Web hooks |
| `AZURE_BLOB_CONNECTION` | [Azure Blob Storage][12] service |
| `LEANCLOUD_API_HOST` | API domain of [LeanCloud][13] |
| `LEANCLOUD_APP_ID` | App ID of [LeanCloud][13] |
| `LEANCLOUD_APP_KEY` | App Key of [LeanCloud][13] |
| `LARK_APP_ID` | App ID of [Lark API][14] |
| `LARK_APP_SECRET` | App Secret of [Lark API][14] |
| `HR_BASE_ID` | BI Table ID of HR data in Lark |
| `PERSON_TABLE_ID` | BI Data Table ID of Person data in Lark |
| Name | Usage |
| :------------------: | :---------------------------------------: |
| `DATABASE_URL` | [PostgreSQL][11] connection string |
| `APP_SECRET` | encrypt Password & Token |
| `WEB_HOOK_TOKEN` | `Authorization` token of Custom Web hooks |
| `LEANCLOUD_API_HOST` | API domain of [LeanCloud][13] |
| `LEANCLOUD_APP_ID` | App ID of [LeanCloud][13] |
| `LEANCLOUD_APP_KEY` | App Key of [LeanCloud][13] |
| `LARK_APP_ID` | App ID of [Lark API][14] |
| `LARK_APP_SECRET` | App Secret of [Lark API][14] |
| `HR_BASE_ID` | BI Table ID of HR data in Lark |
| `PERSON_TABLE_ID` | BI Data Table ID of Person data in Lark |

## Development

Expand Down Expand Up @@ -106,15 +105,15 @@ pnpm container

```shell
git checkout master
git tag v1.0.0 # this version tag comes from ./package.json
git tag v2.0.0 # this version tag comes from ./package.json
git push origin master --tags
```

### Publish Type Package

```shell
git checkout master
git tag type-v1.0.0 # this version tag comes from ./type/package.json
git tag type-v2.0.0 # this version tag comes from ./type/package.json
git push origin master --tags
```

Expand All @@ -129,7 +128,6 @@ git push origin master --tags
[9]: https://github.com/anttiviljami/openapi-backend
[10]: https://github.com/settings/tokens
[11]: https://www.postgresql.org/
[12]: https://azure.microsoft.com/en-us/products/storage/blobs
[13]: https://www.leancloud.cn/
[14]: https://open.feishu.cn/
[15]: https://code.visualstudio.com/
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kys-service",
"version": "1.0.0",
"version": "2.0.0",
"license": "AGPL-3.0",
"author": "shiy2008@gmail.com",
"description": "RESTful API service of KaiYuanShe",
Expand All @@ -14,25 +14,23 @@
},
"main": "dist/index.js",
"dependencies": {
"@azure/storage-blob": "^12.26.0",
"@koa/cors": "^5.0.0",
"@koa/multer": "^3.0.2",
"@koa/router": "^13.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"dotenv": "^16.4.5",
"core-js": "^3.39.0",
"dotenv": "^16.4.7",
"ethers": "^6.13.4",
"file-type": "^16.5.4",
"iterator-helpers-polyfill": "^3.0.1",
"jsonwebtoken": "^9.0.2",
"koa": "^2.15.3",
"koa-bodyparser": "^4.4.1",
"koa-jwt": "^4.0.4",
"koa-logger": "^3.2.1",
"koa2-swagger-ui": "^5.11.0",
"koagger": "^0.3.0",
"koajax": "^3.0.3",
"marked": "^15.0.2",
"koajax": "^3.1.1",
"marked": "^15.0.4",
"mobx": "^6.13.5",
"mobx-lark": "^2.0.0",
"mobx-restful": "^2.0.0",
Expand All @@ -44,19 +42,18 @@
"sqlite3": "^5.1.7",
"tslib": "^2.8.1",
"typeorm": "^0.3.20",
"web-fetch": "^1.4.2",
"web-utility": "^4.4.2"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.7",
"@types/koa": "^2.15.0",
"@types/koa-bodyparser": "^4.3.12",
"@types/koa-logger": "^3.1.5",
"@types/node": "^20.17.7",
"@types/node": "^22.10.2",
"get-git-folder": "^0.1.2",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"lint-staged": "^15.3.0",
"prettier": "^3.4.2",
"ts-node-dev": "^2.0.0",
"typescript": "~5.7.2"
},
Expand Down
Loading

0 comments on commit da90b4e

Please sign in to comment.