# Build stage for PWA
FROM node:20-alpine AS build

WORKDIR /app

# Copy package files
COPY pwa/package*.json ./

# Install dependencies
RUN npm install

# Copy source code
COPY pwa/ ./

# Build the application
RUN npm run build

# Production stage - simple Python server for static files
FROM python:3.11-slim

WORKDIR /usr/share/app

# Copy built assets from build stage
COPY --from=build /app/dist ./dist

# Copy game images
COPY images/ ./dist/images/

# Install simple HTTP server
RUN pip install --no-cache-dir aiofiles

# Copy a simple static file server script
COPY pwa/server.py ./

# Expose port
EXPOSE 80

# Start the server
CMD ["python", "server.py"]
