- Created frontend/Dockerfile with multi-stage build for optimized production bundle - Created frontend/.dockerignore to exclude node_modules and build artifacts - Added frontend service to docker-compose.yml with: - Auto-build from frontend/Dockerfile - Port 3000 mapping - Health checks (wget to http://localhost:3000) - Dependency on healthy Kafka and Redis - Production environment (NODE_ENV=production) - Auto-restart on failure - Proper network connectivity - Created DOCKER_QUICK_START.md with simplified setup guide: - Single docker compose up starts infrastructure + frontend - Cleaner workflow (2-3 terminals instead of 4) - Production-like testing (not dev mode) - Complete troubleshooting section - Updated FULLSTACK_GUIDE.md to highlight Docker-integrated frontend - Frontend now runs as optimized 63KB gzip production build in Docker All components now start together: docker compose up # Infrastructure + React frontend (Docker) uvicorn api.main:app # API (your terminal) python pipeline.py # Consumer (your terminal) Access frontend at: http://localhost:3000 Co-authored-by: Copilot <[email protected]>
38 lines
695 B
Docker
38 lines
695 B
Docker
# Stage 1: Build
|
|
FROM node:18-alpine as builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Stage 2: Run
|
|
FROM node:18-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install serve to run the application
|
|
RUN npm install -g serve
|
|
|
|
# Copy built application from builder
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
|
|
CMD node -e "require('http').get('http://localhost:3000', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
|
|
|
|
# Start the application
|
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|