diff --git a/Dockerfile b/Dockerfile index 34397f7..a5cae63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,43 +9,10 @@ RUN yarn build # nginx:stable-alpine as of 2026-02-22 FROM nginx@sha256:15e96e59aa3b0aada3a121296e3bce117721f42d88f5f64217ef4b18f458c6ab -# Remove default config RUN rm /etc/nginx/conf.d/default.conf -# Config template — envsubst replaces $PORT at container start -COPY <<'EOF' /etc/nginx/netwatch.conf.template -server { - listen $PORT; - server_name _; - - root /usr/share/nginx/html; - index index.html; - - # Trust RFC1918 reverse proxies for X-Forwarded-For - set_real_ip_from 10.0.0.0/8; - set_real_ip_from 172.16.0.0/12; - set_real_ip_from 192.168.0.0/16; - real_ip_header X-Forwarded-For; - real_ip_recursive on; - - # Access log to stdout (Docker best practice) - access_log /dev/stdout combined; - error_log /dev/stderr warn; - - location / { - try_files $uri $uri/ /index.html; - } - - # Cache static assets aggressively - location /assets/ { - expires 1y; - add_header Cache-Control "public, immutable"; - } -} -EOF - +COPY nginx.conf /etc/nginx/conf.d/netwatch.conf COPY --from=build /app/dist /usr/share/nginx/html -ENV PORT=8080 EXPOSE 8080 -CMD ["/bin/sh", "-c", "envsubst '$PORT' < /etc/nginx/netwatch.conf.template > /etc/nginx/conf.d/netwatch.conf && exec nginx -g 'daemon off;'"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..cb176d4 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,28 @@ +server { + listen 8080; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + # Trust RFC1918 reverse proxies for X-Forwarded-For + set_real_ip_from 10.0.0.0/8; + set_real_ip_from 172.16.0.0/12; + set_real_ip_from 192.168.0.0/16; + real_ip_header X-Forwarded-For; + real_ip_recursive on; + + # Access log to stdout (Docker best practice) + access_log /dev/stdout combined; + error_log /dev/stderr warn; + + location / { + try_files $uri $uri/ /index.html; + } + + # Cache static assets aggressively + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +} diff --git a/src/main.js b/src/main.js index 3c12eb1..d9e28c4 100644 --- a/src/main.js +++ b/src/main.js @@ -554,7 +554,7 @@ function hostRowHTML(host, index, showPin = true) {
${pinBtn}
-
+
${host.name}