From 18be821fdb54ecc647675f6c54459335b0a403ec Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Tue, 25 Nov 2025 10:59:17 -0500 Subject: [PATCH] change backend port from 5001 to 5003 --- Dockerfile | 6 +++--- backend/src/index.ts | 17 ++++++++++------- docker-compose.dev.yml | 6 +++--- docker-compose.yml | 6 +++--- frontend/vite.config.ts | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed798911..92c59aeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,7 +56,7 @@ RUN curl -fsSL https://opencode.ai/install | bash && \ ENV NODE_ENV=production ENV HOST=0.0.0.0 -ENV PORT=5001 +ENV PORT=5003 ENV OPENCODE_SERVER_PORT=5551 ENV DATABASE_PATH=/app/data/opencode.db ENV WORKSPACE_PATH=/workspace @@ -73,10 +73,10 @@ RUN chmod +x /docker-entrypoint.sh RUN mkdir -p /workspace /app/data -EXPOSE 5001 +EXPOSE 5003 HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \ - CMD curl -f http://localhost:5001/api/health || exit 1 + CMD curl -f http://localhost:5003/api/health || exit 1 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["bun", "backend/dist/index.js"] diff --git a/backend/src/index.ts b/backend/src/index.ts index 180c3132..d9122969 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -153,14 +153,17 @@ app.all('/api/opencode/*', async (c) => { const isProduction = ENV.SERVER.NODE_ENV === 'production' if (isProduction) { - app.use('/*', async (c, next) => { - if (c.req.path.startsWith('/api/')) { - return next() - } - return serveStatic({ root: './frontend/dist' })(c, next) - }) + app.use('/*', serveStatic({ root: './frontend/dist' })) + app.get('*', async (c) => { - return serveStatic({ path: './frontend/dist/index.html' })(c, async () => {}) + if (c.req.path.startsWith('/api/')) { + return c.notFound() + } + const fs = await import('fs/promises') + const path = await import('path') + const indexPath = path.join(process.cwd(), 'frontend/dist/index.html') + const html = await fs.readFile(indexPath, 'utf-8') + return c.html(html) }) } else { app.get('/', (c) => { diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index a6743c05..c44e2564 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -7,11 +7,11 @@ services: container_name: opencode-backend-dev command: sh -c "cd /app && bun --watch backend/src/index.ts" ports: - - "5001:5001" + - "5003:5003" environment: - NODE_ENV=development - HOST=0.0.0.0 - - PORT=5001 + - PORT=5003 - OPENCODE_SERVER_PORT=5551 - DATABASE_PATH=/app/data/opencode.db - WORKSPACE_PATH=/workspace @@ -33,7 +33,7 @@ services: ports: - "5173:5173" environment: - - VITE_API_URL=http://localhost:5001 + - VITE_API_URL=http://localhost:5003 volumes: - ./frontend:/app/frontend - ./shared:/app/shared diff --git a/docker-compose.yml b/docker-compose.yml index ab53c91f..769bd1d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,11 +5,11 @@ services: dockerfile: Dockerfile container_name: opencode-web ports: - - "5001:5001" + - "5003:5003" environment: - NODE_ENV=production - HOST=0.0.0.0 - - PORT=5001 + - PORT=5003 - OPENCODE_SERVER_PORT=5551 - DATABASE_PATH=/app/data/opencode.db - WORKSPACE_PATH=/workspace @@ -27,7 +27,7 @@ services: - opencode-data:/app/data restart: unless-stopped healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:5001/api/health"] + test: ["CMD", "curl", "-f", "http://localhost:5003/api/health"] interval: 30s timeout: 3s retries: 3 diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index d3b42aa8..8c8689b2 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -16,7 +16,7 @@ export default defineConfig({ port: 5173, proxy: { "/api": { - target: "http://localhost:5001", + target: "http://localhost:5003", changeOrigin: true, }, },