Files
tiny-webhook/Dockerfile
Cauê Faleiros c5e168429d
All checks were successful
Build and Deploy / build-and-push (push) Successful in 43s
Make builds reproducible and redeploys graceful
- Install with npm ci from package-lock.json so a rebuild can't pull
  different dependency versions than were tested.
- Run node directly (not via npm) so it receives SIGTERM and can drain
  queued webhooks; give the stack a 60s stop_grace_period and start the
  new task before stopping the old one.
- Add .dockerignore and stop tracking dist/ (already gitignored and
  rebuilt by the Dockerfile).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:12:09 -03:00

32 lines
742 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files and install the exact locked dependencies (including devDependencies for TypeScript)
COPY package.json package-lock.json ./
RUN npm ci
# Copy source code and build
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files and install ONLY the locked production dependencies
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
# Copy built code from the builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/data ./data
# Expose the port the app runs on
EXPOSE 3000
# Run node directly so it receives SIGTERM on redeploy and can finish queued webhooks
CMD ["node", "dist/index.js"]