44 lines
790 B
Docker
44 lines
790 B
Docker
# Build stage
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source
|
|
COPY tsconfig.json ./
|
|
COPY src ./src
|
|
|
|
# Build
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM mcr.microsoft.com/playwright:v1.41.0-jammy
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy built files and dependencies
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY package*.json ./
|
|
|
|
# Create output directories
|
|
RUN mkdir -p output/logs output/screenshots
|
|
|
|
# Set environment
|
|
ENV NODE_ENV=production
|
|
ENV BOT_HEADLESS=true
|
|
|
|
# Expose port
|
|
EXPOSE 4100
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:4100/health || exit 1
|
|
|
|
# Run
|
|
CMD ["node", "dist/index.js"]
|