From a13d2cb04aed8f4415eb89569a8c9a2298a2088d Mon Sep 17 00:00:00 2001 From: Matthew Daubney Date: Tue, 20 Oct 2026 11:12:20 +0100 Subject: [PATCH] Add Dockerfile, nginx config and docker-compose demo Co-Authored-By: Claude Sonnet 5.5 --- .dockerignore | 6 ++++++ Dockerfile | 11 +++++++++++ README.md | 10 ++++++++++ docker-compose.yml | 36 ++++++++++++++++++++++++++++++++++++ nginx.conf | 14 ++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3f414d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +dist +.git +.idea +.claude +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5d7efa0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:22-alpine AS build +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +RUN npm run build + +FROM nginx:1.27-alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 diff --git a/README.md b/README.md index 875e5a9..c0b4a50 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,16 @@ Licensed under the [BSD 3-Clause License](LICENSE). The UI talks directly to the OpenBao HTTP API from the browser. There is no backend. +## Quick start with Docker + +```sh +docker compose up --build +``` + +Open http://localhost:8080 and connect to `http://localhost:8200` with token `root`. This starts a throwaway in-memory OpenBao dev server (CORS pre-configured for the UI) and the UI. Not for production. + +To run just the UI image: `docker build -t envbao-admin . && docker run -p 8080:80 envbao-admin`. + ## OpenBao setup ### Quickstart (dev mode) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f7c2c04 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +# Local demo: the UI plus a throwaway in-memory OpenBao dev server. +# docker compose up --build +# UI: http://localhost:8080 OpenBao: http://localhost:8200 token: root +services: + openbao: + image: openbao/openbao:latest + cap_add: [IPC_LOCK] + environment: + BAO_DEV_ROOT_TOKEN_ID: root + BAO_DEV_LISTEN_ADDRESS: 0.0.0.0:8200 + ports: + - "8200:8200" + healthcheck: + test: ["CMD", "bao", "status", "-address=http://127.0.0.1:8200"] + interval: 2s + retries: 15 + + # One-shot: allow the UI origin to call OpenBao from the browser. + openbao-setup: + image: openbao/openbao:latest + depends_on: + openbao: + condition: service_healthy + environment: + BAO_ADDR: http://openbao:8200 + BAO_TOKEN: root + entrypoint: ["bao", "write", "sys/config/cors", "enabled=true", "allowed_origins=http://localhost:8080", "allowed_headers=X-Vault-Token,Content-Type"] + restart: "no" + + ui: + build: . + depends_on: + openbao-setup: + condition: service_completed_successfully + ports: + - "8080:80" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..9563e16 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + location / { + try_files $uri /index.html; + } +}