From 219dc88c998112503e46f89534f7e28000167fcf Mon Sep 17 00:00:00 2001 From: BabakBar Date: Thu, 15 Jan 2026 19:39:45 +0100 Subject: [PATCH 1/3] feat: add Dockerfile and docker-compose --- Dockerfile | 12 ++++++++++++ docker-compose.yml | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3691015 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Use the lightweight Nginx Alpine image +FROM nginx:alpine + +COPY ./index.html /usr/share/nginx/html/index.html +COPY ./styles.css /usr/share/nginx/html/styles.css +COPY ./js /usr/share/nginx/html/js + +# Expose port 80 +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..352ad35 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + subgrid: + build: . + container_name: subgrid + ports: + - "8080:80" + restart: unless-stopped From e4cc4a6f66a49710a6f1149617ea22e16852d8eb Mon Sep 17 00:00:00 2001 From: BabakBar Date: Thu, 15 Jan 2026 19:46:10 +0100 Subject: [PATCH 2/3] feat: add Nginx and Docker ignore --- .dockerignore | 7 +++++++ Dockerfile | 10 ++++++++-- nginx.conf | 22 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d5fe158 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git +.github +*.md +LICENSE +wrangler.jsonc +docker-compose.yml +Dockerfile diff --git a/Dockerfile b/Dockerfile index 3691015..8478c14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,18 @@ # Use the lightweight Nginx Alpine image FROM nginx:alpine +# Copy custom nginx config +COPY ./nginx.conf /etc/nginx/conf.d/default.conf + +# Copy static assets COPY ./index.html /usr/share/nginx/html/index.html COPY ./styles.css /usr/share/nginx/html/styles.css COPY ./js /usr/share/nginx/html/js -# Expose port 80 +# Healthcheck +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1 + EXPOSE 80 -# Start Nginx CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..bc295be --- /dev/null +++ b/nginx.conf @@ -0,0 +1,22 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Gzip compression + gzip on; + gzip_types text/css application/javascript; + gzip_min_length 1000; + + # Cache static assets + location ~* \.(css|js)$ { + expires 7d; + add_header Cache-Control "public, immutable"; + } + + # Serve index.html for all routes (SPA fallback) + location / { + try_files $uri $uri/ /index.html; + } +} From d1bff073959adcc255db07805ba68a2a226fae27 Mon Sep 17 00:00:00 2001 From: BabakBar Date: Thu, 15 Jan 2026 19:49:04 +0100 Subject: [PATCH 3/3] docs: include Docker instructions --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index f43b938..7f5709c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ or python -m http.server ``` +With Docker: + +``` +docker compose up +``` + Your data stays in your browser's local storage. ## Stack