📦 refactor(Dockerfile): Удалены повторяющиеся установки зависимостей, улучшена производительностьрыность.
All checks were successful
Deploy / deploy (push) Successful in 2m33s

This commit is contained in:
Oscar
2026-05-28 15:48:09 +03:00
parent 7fd71f27c8
commit 6ae9b32e87

View File

@@ -3,7 +3,6 @@ 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/*
@@ -13,6 +12,9 @@ RUN corepack enable
RUN yarn install --immutable
# Download Chromium into /root/.cache/ms-playwright (with deps for builder OS)
RUN npx playwright install --with-deps chromium
COPY tsconfig.json ./
COPY prisma ./prisma
COPY src ./src
@@ -23,15 +25,13 @@ RUN yarn prisma generate
FROM node:22-slim AS runner
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends openssl && rm -rf /var/lib/apt/lists/*
RUN corepack enable && npm install -g opencode-ai
COPY --from=builder /app/node_modules ./node_modules
# Copy Playwright browser binary and install only system deps (no re-download)
# install Chromium + all system dependencies for Playwright
RUN npx playwright install --with-deps chromium
# Copy pre-downloaded browser binary, then install only system deps (no re-download)
COPY --from=builder /root/.cache/ms-playwright /root/.cache/ms-playwright
RUN npx playwright install-deps chromium
@@ -39,12 +39,10 @@ COPY --from=builder /app/src ./src
COPY --from=builder /app/prisma ./prisma
COPY package.json yarn.lock .yarnrc.yml tsconfig.json ./
# 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 && npx tsx src/index.ts"]