Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# syntax=docker/dockerfile:1
FROM node:20-alpine AS frontend-builder

WORKDIR /app/react

# Copy package files
COPY react/package*.json ./
RUN npm install --force

# Copy frontend source and build
COPY react/ ./
RUN npx vite build

# Python runtime stage
FROM python:3.12-slim AS runtime

WORKDIR /app

# Install system dependencies including curl for healthcheck
RUN apt-get update && apt-get install -y \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*

# Copy Python requirements and install dependencies
COPY server/requirements.txt ./server/
RUN pip install --no-cache-dir -r server/requirements.txt

# Copy server code
COPY server/ ./server/

# Copy built frontend from builder stage
COPY --from=frontend-builder /app/react/dist ./react/dist

# Set environment variables
ENV UI_DIST_DIR=/app/react/dist
ENV HOST=0.0.0.0

# Run the application
WORKDIR /app/server
CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8088"]
6 changes: 6 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ VSCode/Cursor Install Extensions:

`python main.py`



## 使用docker安装

`git clone https://github.com/11cafe/localart`
`docker compose up -d`
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3.8'

services:
jaaz-app:
build:
context: .
dockerfile: Dockerfile
ports:
- "8088:8088"
environment:
- UI_DIST_DIR=/app/react/dist
volumes:
# Optional: mount for persistent data
- ./data:/app/data
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8088/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
5 changes: 2 additions & 3 deletions electron/comfyUIInstaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ async function getLatestComfyUIRelease() {
if (res.statusCode !== 200) {
reject(
new Error(
`GitHub API error: ${res.statusCode} - ${
release.message || 'Unknown error'
`GitHub API error: ${res.statusCode} - ${release.message || 'Unknown error'
}`
)
)
Expand Down Expand Up @@ -618,7 +617,7 @@ async function updateConfigWithComfyUI() {
try {
// Call backend API to update configuration
const response = await fetch(
'http://127.0.0.1:57988/api/comfyui/update_config',
'http://127.0.0.1:8088/api/comfyui/update_config',
{
method: 'POST',
headers: {
Expand Down
14 changes: 7 additions & 7 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const appRoot = app.getAppPath()

const startPythonApi = async () => {
// Find an available port
pyPort = await findAvailablePort(57988)
pyPort = await findAvailablePort(8088)
console.log('available pyPort:', pyPort)

// 在某些开发情况,我们希望 python server 独立运行,那么就不通过 electron 启动
Expand Down Expand Up @@ -216,12 +216,12 @@ const startPythonApi = async () => {
const isWindows = process.platform === 'win32'
const pythonExecutable = app.isPackaged
? path.join(
process.resourcesPath,
'server',
'dist',
'main',
isWindows ? 'main.exe' : 'main'
)
process.resourcesPath,
'server',
'dist',
'main',
isWindows ? 'main.exe' : 'main'
)
: 'python'
console.log('Resolved Python executable:', pythonExecutable)

Expand Down
2 changes: 1 addition & 1 deletion react/src/contexts/socket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const SocketProvider: React.FC<SocketProviderProps> = ({ children }) => {
if (!socketManagerRef.current) {
socketManagerRef.current = new SocketIOManager({
serverUrl: process.env.NODE_ENV === 'development'
? 'http://localhost:57988'
? 'http://localhost:8088'
: window.location.origin,
autoConnect: false
})
Expand Down
12 changes: 6 additions & 6 deletions react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import react from '@vitejs/plugin-react'
import path from 'path'
import { defineConfig, UserConfig } from 'vite'

const PORT = 57988
const PORT = 8088

// https://vite.dev/config/
export default defineConfig(({ mode }) => {
Expand All @@ -14,11 +14,11 @@ export default defineConfig(({ mode }) => {
const config: UserConfig = {
plugins: [
!isLibMode &&
TanStackRouterVite({
target: 'react',
autoCodeSplitting: true,
generatedRouteTree: 'src/route-tree.gen.ts',
}),
TanStackRouterVite({
target: 'react',
autoCodeSplitting: true,
generatedRouteTree: 'src/route-tree.gen.ts',
}),
react(),
tailwindcss(),
].filter(Boolean),
Expand Down
2 changes: 1 addition & 1 deletion server/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import os

DEFAULT_PORT = int(os.environ.get('DEFAULT_PORT', 57988))
DEFAULT_PORT = int(os.environ.get('DEFAULT_PORT', 8088))
11 changes: 6 additions & 5 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from fastapi.staticfiles import StaticFiles
from fastapi import FastAPI
import argparse
import uvicorn
from contextlib import asynccontextmanager
from starlette.types import Scope
from starlette.responses import Response
Expand Down Expand Up @@ -98,10 +99,10 @@ async def serve_react_app():
sorted(_bypass | current - {""}))

parser = argparse.ArgumentParser()
parser.add_argument('--port', type=int, default=57988,
parser.add_argument('--host', type=str, default="127.0.0.1",
help='Host to run the server on')
parser.add_argument('--port', type=int, default=8088,
help='Port to run the server on')
args = parser.parse_args()
import uvicorn
print("🌟Starting server, UI_DIST_DIR:", os.environ.get('UI_DIST_DIR'))

uvicorn.run(socket_app, host="127.0.0.1", port=args.port)

uvicorn.run(socket_app, host=args.host, port=args.port)