mirror of
https://github.com/stackrender/stackrender.git
synced 2026-09-10 11:15:42 +00:00
Add Docker support with Dockerfile, docker-compose, and nginx config
Co-authored-by: oovaa <103980029+oovaa@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Build outputs
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Docker
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
docker-compose.yml
|
||||
|
||||
# Misc
|
||||
README.md
|
||||
LICENSE
|
||||
CODE_OF_CONDUCT.md
|
||||
CONTRIBUTING.md
|
||||
SECURITY.md
|
||||
|
||||
# Lock files (we keep package-lock.json but ignore others)
|
||||
pnpm-lock.yaml
|
||||
yarn.lock
|
||||
bun.lockb
|
||||
|
||||
# Vite cache
|
||||
vite.config.ts.timestamp-*
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
# Build stage - using standard debian-based node image for better compatibility
|
||||
FROM node:20 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
# Note: strict-ssl is disabled to handle potential certificate issues in some build environments
|
||||
RUN npm config set strict-ssl false && npm install
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built files from builder stage
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -45,18 +45,36 @@ And more coming very soon!
|
||||
|
||||
Use the [cloud version](https://www.stackrender.io) or deploy locally to start designing your database schemas in minutes.
|
||||
|
||||
### How to Use
|
||||
### How to Use Locally
|
||||
|
||||
#### Using Docker (Recommended)
|
||||
The easiest way to run StackRender locally is using Docker:
|
||||
|
||||
```bash
|
||||
# Build and run using Docker Compose
|
||||
docker-compose up
|
||||
|
||||
# Or build and run using Docker directly
|
||||
docker build -t stackrender .
|
||||
docker run -p 8080:80 stackrender
|
||||
```
|
||||
|
||||
Then visit `http://localhost:8080` in your browser.
|
||||
|
||||
#### Using Node.js
|
||||
Install dependencies and start the development server:
|
||||
```text
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### How to Build
|
||||
Install dependencies and start the production build:
|
||||
```text
|
||||
Install dependencies and create a production build:
|
||||
```bash
|
||||
npm install
|
||||
npm run start
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Try Using It in the Cloud
|
||||
|
||||
1. Visit [StackRender.io](https://www.stackrender.io)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
stackrender:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: stackrender:latest
|
||||
container_name: stackrender
|
||||
ports:
|
||||
- "8080:80"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# Handle client-side routing
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|wasm)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user