Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[migrate] replace Crawler controller with idea2app/Web-file-cache service #31

Merged
merged 5 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:22-slim AS base
RUN apt-get update && \
apt-get install curl -y --no-install-recommends
RUN mv /home/pptruser/.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"]
37 changes: 18 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,19 @@ 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 |
| `WEB_HOST` | Web front-end host with Lark file proxy |
| `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 +106,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 +129,6 @@ git push origin master --tags
[9]: https://github.com/anttiviljami/openapi-backend
[10]: https://github.com/settings/tokens/new?description=KYS-service&scopes=read:packages
[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/
12 changes: 4 additions & 8 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": "[email protected]",
"description": "RESTful API service of KaiYuanShe",
Expand All @@ -17,16 +17,13 @@
"node": ">=22"
},
"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.7",
"ethers": "^6.13.5",
"file-type": "^16.5.4",
"iterator-helpers-polyfill": "^3.0.1",
"jsonwebtoken": "^9.0.2",
"koa": "^2.15.3",
"koa-bodyparser": "^4.4.1",
Expand All @@ -47,18 +44,17 @@
"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/jsonwebtoken": "^9.0.8",
"@types/koa": "^2.15.0",
"@types/koa-bodyparser": "^4.3.12",
"@types/koa-logger": "^3.1.5",
"@types/node": "^22.10.7",
"@types/node": "^22.10.10",
"get-git-folder": "^0.1.2",
"husky": "^9.1.7",
"lint-staged": "^15.4.1",
"lint-staged": "^15.4.2",
"prettier": "^3.4.2",
"ts-node-dev": "^2.0.0",
"typescript": "~5.7.3"
Expand Down
Loading
Loading