File size: 1,345 Bytes
34fe2fb
 
 
 
 
80e15a7
34fe2fb
80e15a7
34fe2fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80e15a7
 
34fe2fb
80e15a7
 
34fe2fb
 
 
 
 
80e15a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Use the scottyhardy/docker-remote-desktop as the base image
FROM scottyhardy/docker-remote-desktop:latest

# Set up environment variables
ENV PYTHONUNBUFFERED=1
# Ensure RDP server is configured properly
ENV RDP_SERVER=yes
ENV DEBIAN_FRONTEND=noninteractive

# Install Python dependencies
RUN apt-get update && \
    apt-get install -y python3 python3-pip python3-venv python3-full && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Create a working directory
WORKDIR /app

# Copy application files
COPY main.py /app/

# Create and activate virtual environment
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"

# Install Python dependencies in the virtual environment
RUN /app/venv/bin/pip install --no-cache-dir fastapi uvicorn websockets

# Expose both WebSocket tunnel port and RDP port
EXPOSE 7860 3389

# Create startup script to run the WebSocket tunnel only
# Skip trying to start RDP services that require root permissions
RUN echo '#!/bin/bash\n\
echo "Starting WebSocket tunnel service on port 7860..."\n\
echo "Remote desktop service should be available at localhost:3389"\n\
# Start WebSocket tunnel\n\
/app/venv/bin/python /app/main.py\n\
' > /app/start.sh && chmod +x /app/start.sh

# Set the entrypoint to run the startup script
CMD ["/bin/bash", "/app/start.sh"]