Files
url_tracker_tool/apps/web/Dockerfile
Andrei 956f1aeadb feat(phase-0): setup Docker Compose with TypeScript monorepo structure
- Create monorepo structure with apps/ and packages/
- Add Docker Compose for api, web, db, redis, worker services
- Migrate existing Express.js logic to TypeScript with 100% backward compatibility
- Preserve all existing API endpoints (/api/track, /api/v1/track) with identical behavior
- Setup development environment with hot reload and proper networking
- Add comprehensive TypeScript configuration with path mapping
- Include production-ready Dockerfiles with multi-stage builds
- Maintain existing rate limiting (100 req/hour/IP) and response formats
- Add health checks and graceful shutdown handling
- Setup Turbo for efficient monorepo builds and development
2025-08-18 07:03:08 +00:00

64 lines
1.3 KiB
Docker

# Multi-stage build for production optimization
FROM node:20-alpine AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY apps/web/package*.json ./apps/web/
COPY packages/shared/package*.json ./packages/shared/
# Install dependencies
RUN npm ci --only=production && npm cache clean --force
# Development stage
FROM base AS dev
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY apps/web/package*.json ./apps/web/
COPY packages/shared/package*.json ./packages/shared/
# Install all dependencies including devDependencies
RUN npm ci
# Copy source code
COPY apps/web ./apps/web
COPY packages/shared ./packages/shared
WORKDIR /app/apps/web
EXPOSE 3000
CMD ["npm", "run", "dev"]
# Build stage
FROM base AS builder
WORKDIR /app
# Copy everything needed for build
COPY package*.json ./
COPY apps/web ./apps/web
COPY packages/shared ./packages/shared
# Install dependencies and build
RUN npm ci
WORKDIR /app/apps/web
RUN npm run build
# Production stage
FROM nginx:alpine AS production
# Copy built application
COPY --from=builder /app/apps/web/dist /usr/share/nginx/html
# Copy nginx configuration
COPY apps/web/nginx.conf /etc/nginx/nginx.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]