06112602ec
Version the NestJS TDLib gateway with Docker deployment, migrations, automated tests and platform integration documentation while excluding all account sessions, credentials, runtime databases and backups.
44 lines
1.0 KiB
Docker
44 lines
1.0 KiB
Docker
FROM node:20-bookworm-slim AS builder
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends g++ make python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* ./
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm ci \
|
|
--prefer-offline \
|
|
--fetch-retries=8 \
|
|
--fetch-retry-mintimeout=2000 \
|
|
--fetch-retry-maxtimeout=30000 \
|
|
--fetch-timeout=600000
|
|
|
|
COPY tsconfig.json nest-cli.json ./
|
|
COPY src/ ./src/
|
|
RUN npm run build
|
|
RUN npm prune --omit=dev
|
|
|
|
FROM node:20-bookworm-slim
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends tini ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --chown=node:node --from=builder /app/dist ./dist
|
|
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
|
|
COPY --chown=node:node package.json ./
|
|
|
|
RUN mkdir -p /app/uploads /app/tdlib_data \
|
|
&& chown node:node /app/uploads /app/tdlib_data
|
|
|
|
USER node
|
|
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
CMD ["node", "dist/main.js"]
|