feat: improve dockerfile

This commit is contained in:
orig
2024-08-29 21:55:37 +03:00
committed by Jonathan Fishner
parent 09e1ae4abb
commit 48a0f4f240
3 changed files with 89 additions and 14 deletions

45
.dockerignore Normal file
View File

@@ -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

View File

@@ -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;"]

View File

@@ -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