From 4761214ec184e1e4e030d9f18882a1dd8b5cc6b3 Mon Sep 17 00:00:00 2001 From: Oscar Date: Wed, 27 May 2026 20:26:02 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5(bot-commands):=20=D0=9E=D0=B1=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BE=D1=82=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D0=BF=D1=80=D0=BE=D0=BF=D1=83=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=D0=B0=D0=BA=D0=B0=D0=BD=D1=81?= =?UTF-8?q?=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 13 +++++++++++++ Dockerfile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a994a25 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +node_modules +dist +.env +.env.* +prisma/dev.db +prisma/dev.db-journal +prisma/migrations/*.db +.idea +.vscode +coverage +*.log +.cache +.tmp diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..34552a6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +# ── Stage 1: build ───────────────────────────────────────────────────────────── +FROM node:22-slim AS builder + +WORKDIR /app + +# build tools for native modules +RUN apt-get update && apt-get install -y --no-install-recommends \ + python3 make g++ \ + && rm -rf /var/lib/apt/lists/* + +COPY package.json yarn.lock .yarnrc.yml ./ +RUN corepack enable + +RUN yarn install --immutable + +COPY tsconfig.json ./ +COPY prisma ./prisma +COPY src ./src + +RUN yarn prisma generate && yarn build + +# ── Stage 2: runtime ─────────────────────────────────────────────────────────── +FROM node:22-slim AS runner + +WORKDIR /app + +RUN corepack enable + +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/prisma ./prisma +COPY package.json yarn.lock .yarnrc.yml ./ + +# install Chromium + all system dependencies for Playwright +RUN npx playwright install --with-deps chromium + +# SQLite data lives on a volume so it survives container restarts +RUN mkdir -p /data +ENV DATABASE_URL="file:/data/dev.db" +ENV NODE_ENV=production + +VOLUME ["/data"] + +# apply pending migrations then start the bot +CMD ["sh", "-c", "npx prisma migrate deploy && node dist/index.js"]