# Serveert de statische Tetris-game via nginx.
# nginx:alpine draait standaard de master als root en wisselt zelf naar de
# 'nginx'-user voor de workers; hierdoor werkt de entrypoint-configuratie
# (schrijven naar /etc/nginx/conf.d en /var/cache) zonder aanpassingen.
FROM nginx:1.27-alpine

# Game-bestanden kopieren naar de web-root
COPY game/ /usr/share/nginx/html/

# Extra headers voor veiligheid en caching
RUN { \
      echo 'server_tokens off;'; \
      echo 'add_header X-Content-Type-Options nosniff;'; \
      echo 'gzip_types text/css application/javascript application/json image/svg+xml;'; \
    } > /etc/nginx/conf.d/security.conf

EXPOSE 80

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget --quiet --tries=1 --spider http://127.0.0.1/ || exit 1

