FROM nginx:1.27-alpine

# Configure nginx to listen on 5001 to match container port expectations.
RUN sed -i 's/listen       80;/listen       5001;/' /etc/nginx/conf.d/default.conf

# Build a custom landing page directly in the image.
RUN set -eux; \
	{ \
		echo '<!doctype html>'; \
		echo '<html lang="en">'; \
		echo '<head>'; \
		echo '  <meta charset="utf-8">'; \
		echo '  <meta name="viewport" content="width=device-width, initial-scale=1">'; \
		echo '  <title>Brencher Test App</title>'; \
		echo '</head>'; \
		echo '<body>'; \
		echo '  <h1>Nginx Is Running</h1>'; \
		echo '  <p>Custom landing page for the Brencher test app container.</p>'; \
		echo '  <p>Port: 5001</p>'; \
		echo '  <p>Git revision: unknown</p>'; \
		echo '</body>'; \
		echo '</html>'; \
	} > /usr/share/nginx/html/index.html

EXPOSE 5001
