FROM nginx:alpine

# Remove default nginx static assets
RUN rm -rf /usr/share/nginx/html/*

# Copy static assets into nginx
COPY apps/dashboard/*.html /usr/share/nginx/html/
COPY apps/dashboard/js /usr/share/nginx/html/js/
COPY apps/dashboard/css /usr/share/nginx/html/css/

# Fix networking issues by adding a simple redirect for spa if needed
# But for hash-based routing, default index.html is enough.
# We also need to handle the API proxy if we want to avoid CORS issues
# However, the user's docker-compose has the API and Dashboard on different ports.
# In a real production, we'd use Nginx to proxy /api to the backend.

COPY infrastructure/docker/dashboard/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
