Files
textbee/api/Dockerfile
isra el f6a8f21e64 fix(infra): pin pnpm to v9 in Dockerfiles and update GitHub Actions
pnpm v10 is now the npm "latest" tag but generates a different lockfile
format than v9.0 used in this repo, causing --frozen-lockfile to fail.
Replace corepack pnpm@latest with npm install -g pnpm@9 in api and web
Dockerfiles. Also bump docker/* actions to v3/v6 to resolve Node.js 20
deprecation warnings ahead of the June 2026 forced migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 07:28:30 +03:00

61 lines
1.4 KiB
Docker

# Stage 1: Dependencies
FROM node:22-alpine AS deps
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm@9
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Stage 2: Builder
FROM node:22-alpine AS builder
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm@9
# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build the application
RUN pnpm build
# Stage 3: Production
FROM node:22-alpine AS runner
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm@9
# Set NODE_ENV to production
ENV NODE_ENV production
# Copy necessary files for production
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml ./
# Install only production dependencies
RUN pnpm install --prod --frozen-lockfile
# Add a non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nestjs && \
chown -R nestjs:nodejs /app
USER nestjs
# Expose the port specified by the PORT environment variable (default: 3001)
ENV PORT 300
EXPOSE ${PORT}
# Health check to verify app is running
# HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
# CMD wget -q -O - http://localhost:${PORT}/api/v1/health || exit 1
# Command to run the application
CMD ["node", "dist/main"]