strat-gameplay-webapp/frontend-sba/Dockerfile
Cal Corum e0c12467b0 CLAUDE: Improve UX with single-click OAuth, enhanced games list, and layout fix
Frontend UX improvements:
- Single-click Discord OAuth from home page (no intermediate /auth page)
- Auto-redirect authenticated users from home to /games
- Fixed Nuxt layout system - app.vue now wraps NuxtPage with NuxtLayout
- Games page now has proper card container with shadow/border styling
- Layout header includes working logout with API cookie clearing

Games list enhancements:
- Display team names (lname) instead of just team IDs
- Show current score for each team
- Show inning indicator (Top/Bot X) for active games
- Responsive header with wrapped buttons on mobile

Backend improvements:
- Added team caching to SbaApiClient (1-hour TTL)
- Enhanced GameListItem with team names, scores, inning data
- Games endpoint now enriches response with SBA API team data

Docker optimizations:
- Optimized Dockerfile using --chown flag on COPY (faster than chown -R)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 16:14:00 -06:00

75 lines
1.5 KiB
Docker

# Frontend Dockerfile for SBA League
# Multi-stage build for optimized production image
FROM node:22-alpine as base
# Set working directory
WORKDIR /app
# Development stage
FROM base as development
# Copy package files
COPY package*.json ./
# Install all dependencies (including dev)
RUN npm ci
# Copy application code
COPY . .
# Expose port
EXPOSE 3000
# Set development environment
ENV NODE_ENV=development
# Run development server with hot-reload
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
# Build stage
FROM base as builder
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy application code
COPY . .
# Build application
RUN npm run build
# Production stage
FROM base as production
# Create non-root user FIRST (before copying files)
RUN addgroup -g 1001 -S nodejs && \
adduser -S nuxt -u 1001
# Set production environment
ENV NODE_ENV=production
# Set ownership during COPY (much faster than chown -R)
COPY --chown=nuxt:nodejs package*.json ./
# Install production dependencies only
RUN npm ci --omit=dev && chown -R nuxt:nodejs node_modules
# Copy built application with correct ownership (avoids slow chown -R)
COPY --from=builder --chown=nuxt:nodejs /app/.output /app/.output
# Switch to non-root user
USER nuxt
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
# Run production server
CMD ["node", ".output/server/index.mjs"]