#!/bin/bash
# Serve current directory on port 8090 using Docker with directory listing

docker run --rm -d \
  --name file-server-8090 \
  -p 8090:80 \
  -v "$(pwd):/usr/share/nginx/html:ro" \
  -e NGINX_ENTRYPOINT_QUIET_LOGS=1 \
  nginx:alpine \
  sh -c 'echo "server { listen 80; location / { root /usr/share/nginx/html; autoindex on; } }" > /etc/nginx/conf.d/default.conf && nginx -g "daemon off;"'

echo "Server running at http://localhost:8090"
echo "To stop: ./stop.sh"
