-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[optimize] reduce Docker image size & update Upstream packages
- Loading branch information
Showing
3 changed files
with
441 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
FROM ghcr.io/puppeteer/puppeteer:latest | ||
# Reference: https://pnpm.io/docker#example-1-build-a-bundle-in-a-docker-container | ||
|
||
FROM ghcr.io/puppeteer/puppeteer:latest AS base | ||
USER root | ||
RUN apt-get update && \ | ||
apt-get install curl -y --no-install-recommends | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY . . | ||
|
||
RUN mkdir /home/pptruser/app | ||
WORKDIR /home/pptruser/app | ||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --prod --frozen-lockfile | ||
|
||
COPY package.json /home/pptruser/app | ||
RUN npm i --force | ||
FROM base AS build | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile | ||
RUN pnpm build | ||
|
||
COPY . /home/pptruser/app | ||
RUN npm run build | ||
FROM base | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
COPY --from=build /app/dist /app/dist | ||
|
||
EXPOSE 8080 | ||
CMD ["npm", "start"] | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "kys-service", | ||
"version": "0.6.6", | ||
"version": "0.6.7", | ||
"license": "AGPL-3.0", | ||
"author": "[email protected]", | ||
"description": "RESTful API service of KaiYuanShe", | ||
|
@@ -14,7 +14,7 @@ | |
}, | ||
"main": "dist/index.js", | ||
"dependencies": { | ||
"@azure/storage-blob": "^12.16.0", | ||
"@azure/storage-blob": "^12.17.0", | ||
"@koa/cors": "^4.0.0", | ||
"class-transformer": "^0.5.1", | ||
"class-validator": "^0.14.0", | ||
|
@@ -28,9 +28,9 @@ | |
"koa-logger": "^3.2.1", | ||
"koa-multer": "^1.0.2", | ||
"koa-router": "^12.0.1", | ||
"koa2-swagger-ui": "^5.9.1", | ||
"koa2-swagger-ui": "^5.10.0", | ||
"koagger": "^0.3.0", | ||
"koajax": "^0.9.4", | ||
"koajax": "^0.9.5", | ||
"mobx": "^5.15.7", | ||
"mobx-lark": "^1.0.0-rc.10", | ||
"mobx-restful": "^0.6.12", | ||
|
@@ -45,18 +45,18 @@ | |
"web-fetch": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"@types/jsonwebtoken": "^9.0.4", | ||
"@types/koa": "^2.13.10", | ||
"@types/koa-bodyparser": "^4.3.11", | ||
"@types/koa-logger": "^3.1.4", | ||
"@types/koa-router": "^7.4.6", | ||
"@types/node": "^18.18.6", | ||
"@types/jsonwebtoken": "^9.0.5", | ||
"@types/koa": "^2.13.12", | ||
"@types/koa-bodyparser": "^4.3.12", | ||
"@types/koa-logger": "^3.1.5", | ||
"@types/koa-router": "^7.4.8", | ||
"@types/node": "^18.18.12", | ||
"get-git-folder": "^0.1.2", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^15.0.2", | ||
"prettier": "^3.0.3", | ||
"lint-staged": "^15.1.0", | ||
"prettier": "^3.1.0", | ||
"ts-node-dev": "^2.0.0", | ||
"typescript": "~5.2.2" | ||
"typescript": "~5.3.2" | ||
}, | ||
"prettier": { | ||
"singleQuote": true, | ||
|
@@ -68,7 +68,7 @@ | |
"*.{md,json,yml,ts}": "prettier --write" | ||
}, | ||
"scripts": { | ||
"prepare": "husky install", | ||
"prepare": "husky install || true", | ||
"install": "get-git-folder https://github.com/kaiyuanshe/service-configuration.git main KYS-service || true", | ||
"test": "lint-staged", | ||
"dev": "ts-node-dev src/", | ||
|
Oops, something went wrong.