Optimize docker image build

This commit is contained in:
2022-03-14 20:18:30 +03:00
parent 6d50c45fa4
commit c7bad506e1
4 changed files with 418 additions and 424 deletions

View File

@@ -6,7 +6,7 @@ COPY ./package.json ./
COPY ./tsconfig.json ./ COPY ./tsconfig.json ./
COPY ./src ./src COPY ./src ./src
RUN npm i && npm run build RUN yarn install --production && yarn build
FROM node:lts-alpine as runtime-image FROM node:lts-alpine as runtime-image
@@ -16,8 +16,6 @@ WORKDIR /root/app
COPY ./package.json ./ COPY ./package.json ./
COPY ./scripts/healthcheck.js ./ COPY ./scripts/healthcheck.js ./
RUN npm i --only=production
COPY --from=build-image /root/app/build ./build COPY --from=build-image /root/app/build ./build
CMD npm run run CMD yarn run run

View File

@@ -23,15 +23,15 @@
"js-base64": "^3.7.2", "js-base64": "^3.7.2",
"moment": "^2.29.1", "moment": "^2.29.1",
"safe-compare": "^1.1.4", "safe-compare": "^1.1.4",
"telegraf": "^4.4.2" "telegraf": "^4.4.2",
"esbuild": "^0.14.2",
"typescript": "^4.5.2"
}, },
"devDependencies": { "devDependencies": {
"@types/chunk-text": "^1.0.0", "@types/chunk-text": "^1.0.0",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"@types/node": "^16.11.9", "@types/node": "^16.11.9",
"@types/safe-compare": "^1.1.0", "@types/safe-compare": "^1.1.0",
"esbuild": "^0.14.2", "nodemon": "^2.0.15"
"nodemon": "^2.0.15",
"typescript": "^4.5.2"
} }
} }

View File

@@ -93,6 +93,8 @@ export default class BotsManager {
const webhookInfo = await bot.telegram.getWebhookInfo(); const webhookInfo = await bot.telegram.getWebhookInfo();
const previousPendingUpdateCount = this.botsPendingUpdatesCount[state.id] || 0; const previousPendingUpdateCount = this.botsPendingUpdatesCount[state.id] || 0;
console.log(state.id, previousPendingUpdateCount, webhookInfo.pending_update_count);
if (previousPendingUpdateCount !== 0 && webhookInfo.pending_update_count !== 0) { if (previousPendingUpdateCount !== 0 && webhookInfo.pending_update_count !== 0) {
this._setWebhook(bot, state); this._setWebhook(bot, state);
} }

826
yarn.lock

File diff suppressed because it is too large Load Diff