This commit is contained in:
Baobhan Sith
2025-04-28 17:58:09 +08:00
parent fe172fdbed
commit 652a47404c
3 changed files with 25 additions and 7 deletions
+3 -1
View File
@@ -15,9 +15,11 @@ COPY packages/frontend/src ./packages/frontend/src
COPY packages/frontend/index.html ./packages/frontend/
COPY packages/frontend/tsconfig.json ./packages/frontend/
COPY packages/frontend/vite.config.ts ./packages/frontend/
COPY packages/frontend/.env ./packages/frontend/
# Copy the root .env file into the builder stage so Vite can read it during build
COPY .env ./.env
RUN npm run build --workspace=@nexus-terminal/frontend
FROM nginx:stable-alpine
@@ -40,19 +40,19 @@ const MIN_MODAL_HEIGHT = 768;
// Dynamically construct WebSocket URL based on environment
let backendBaseUrl: string;
const LOCAL_BACKEND_URL = 'ws://localhost:18112'
if (import.meta.env.DEV && import.meta.env.VITE_BACKEND_WS_URL) {
// Development mode: Use the URL specified in .env
backendBaseUrl = import.meta.env.VITE_BACKEND_WS_URL;
console.log(`[RDP Modal] Using development WebSocket Base URL from env: ${backendBaseUrl}`);
// Determine WebSocket URL based on hostname
if (window.location.hostname === 'localhost') {
backendBaseUrl = LOCAL_BACKEND_URL;
console.log(`[RDP Modal] Using localhost WebSocket Base URL: ${backendBaseUrl}`);
} else {
// Production mode: Construct URL based on current window location
// Fallback: Construct URL based on current window location for production/other environments
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsHostAndPort = window.location.host;
backendBaseUrl = `${wsProtocol}//${wsHostAndPort}`;
console.log(`[RDP Modal] Using production WebSocket Base URL from window.location: ${backendBaseUrl}`);
}
// Removed localStorage keys
const connectRdp = async () => { // Removed useInputValues parameter
if (!props.connection || !rdpDisplayRef.value) {
+16
View File
@@ -30,6 +30,22 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY packages/rdp/package.json ./package.json
# --- Add patch application steps ---
# Copy the patches directory from the build context (relative to project root)
COPY patches ./patches
# Install patch-package temporarily to apply patches
# Note: We install it here again in case prune removed it, and ensure it's available in the final stage.
# Using --no-save as we don't need it in the final package.json dependencies.
RUN npm install patch-package --no-save
# Apply patches
RUN npx patch-package --error-on-fail
# Uninstall patch-package after applying to keep the image clean
RUN npm uninstall patch-package
# --- End patch application steps ---
# Expose the API and WebSocket ports
EXPOSE 9090
EXPOSE 8081