feat: env-var-ize WS URL as CUSTOM_VITE_WS_URL, add .env.example
Docker Build (ARM64) / Build & Push (push) Successful in 50s
Docker Build (ARM64) / Build & Push (push) Successful in 50s
This commit is contained in:
@@ -6,6 +6,9 @@ FROM node:20-alpine AS frontend-builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG CUSTOM_VITE_WS_URL
|
||||
ENV CUSTOM_VITE_WS_URL=$CUSTOM_VITE_WS_URL
|
||||
|
||||
COPY package*.json ./
|
||||
RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.canvas
|
||||
args:
|
||||
- CUSTOM_VITE_WS_URL=${CUSTOM_VITE_WS_URL:-wss://excalidraw.forkless.com}
|
||||
image: celstnblacc/excalidraw-mcp-sentinel-canvas:latest
|
||||
container_name: mcp-excalidraw-canvas
|
||||
ports:
|
||||
|
||||
@@ -435,7 +435,7 @@ function App(): JSX.Element {
|
||||
return
|
||||
}
|
||||
|
||||
const wsUrl = 'wss://excalidraw.forkless.com'
|
||||
const wsUrl = import.meta.env.CUSTOM_VITE_WS_URL || 'wss://excalidraw.forkless.com'
|
||||
|
||||
websocketRef.current = new WebSocket(wsUrl)
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
const wsUrl = process.env.CUSTOM_VITE_WS_URL || 'wss://excalidraw.forkless.com';
|
||||
|
||||
export default defineConfig({
|
||||
root: 'frontend',
|
||||
plugins: [react()],
|
||||
define: {
|
||||
'import.meta.env.CUSTOM_VITE_WS_URL': JSON.stringify(wsUrl),
|
||||
},
|
||||
build: {
|
||||
outDir: '../dist/frontend',
|
||||
emptyOutDir: true,
|
||||
|
||||
Reference in New Issue
Block a user