Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

feat: improve dockerfile

orig48a0f4f240f9
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..88351d3f
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,45 @@
+# Ignore node_modules and build directories
+node_modules
+dist
+build
+
+# Ignore logs
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# Ignore local environment files
+.env
+.env.local
+.env.*.local
+
+# Ignore Dockerfile and Docker Compose files
+Dockerfile
+docker-compose.yml
+
+# Ignore git files
+.git
+.gitignore
+
+# Ignore IDE and editor settings
+.vscode/
+.idea/
+
+# Ignore tests and documentation
+__tests__/
+test/
+tests/
+spec/
+*.md
+
+# Ignore temporary files
+*.swp
+*.swo
+*.DS_Store
+*.log
+*.lock
+*.tmp
+
+# Ignore coverage output
+coverage
diff --git a/Dockerfile b/Dockerfile
index 7e28ccff..71583805 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,21 @@
-FROM node:22
+FROM node:22-alpine AS builder
WORKDIR /usr/src/app
-COPY package.json ./
+COPY package.json package-lock.json ./
-RUN npm install
+RUN npm ci
COPY . .
-EXPOSE 5173
+RUN npm run build
-CMD ["npm", "run", "dev"]
+# Use a lightweight web server to serve the production build
+FROM nginx:stable-alpine AS production
+
+COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
+
+# Expose the default port for the Nginx web server
+EXPOSE 80
+
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/README.md b/README.md
index 064bd734..ce4667a5 100644
--- a/README.md
+++ b/README.md
@@ -63,11 +63,19 @@ ChartDB is currently in Public Beta. Star and watch this repository to get notif
- ✅ MariaDB
- ✅ SQLite
+
## Getting Started
-Use the [cloud version](https://app.chartdb.io/) or deploy locally:
+### How to use the cloud version of ChartDB
-### How To Use
+1. Go to [ChartDB.io](https://chartdb.io)
+2. Click "Go to app"
+3. Choose the database that you are using.
+4. Take the magic query and run it in your database.
+5. Copy and paste the resulting JSON set into ChartDB.
+6. Enjoy Viewing & Editing!
+
+### How To Use ChartDB Locally
```bash
npm install
@@ -88,14 +96,28 @@ npm install
VITE_OPENAI_API_KEY=<YOUR_OPEN_AI_KEY> npm run build
```
-## Try it on our website
+## How to run ChartDB within a Docker container
-1. Go to [ChartDB.io](https://chartdb.io)
-2. Click "Go to app"
-3. Choose the database that you are using.
-4. Take the magic query and run it in your database.
-5. Copy and paste the resulting JSON set into ChartDB.
-6. Enjoy Viewing & Editing!
+### Prerequisites
+
+- Ensure you have [Docker](https://docs.docker.com/get-docker/) installed on your machine.
+
+### Building the Docker Image
+
+```bash
+docker build -t chartdb .
+```
+
+### Running the Docker Container
+
+```bash
+docker run -p 8080:80 chartdb
+```
+
+Open your browser and navigate to `http://localhost:8080`.
+
+
+Happy diagramming! 🎉
## 💚 Community & Support