File size: 1,297 Bytes
3b2d6e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
# Ubuntu base image ka use kar rahe hain
FROM ubuntu:22.04

# Interactive prompts ko disable karne ke liye
ENV DEBIAN_FRONTEND=noninteractive

# System packages install karna (LXDE, XRDP, aur baaki zaroori tools)
RUN apt-get update && apt-get install -y \
    lxde \
    xrdp \
    xterm \
    sudo \
    curl \
    wget \
    git \
    &> /dev/null && rm -rf /var/lib/apt/lists/*

# Ek naya user create kar rahe hain kyunki Hugging Face root user allow nahi karta
RUN useradd -m -s /bin/bash hfuser && \
    echo "hfuser:password123" | chpasswd && \
    adduser hfuser sudo

# XRDP ko configure karna taaki wo root ke bina chal sake
RUN sed -i 's/3389/7860/g' /etc/xrdp/xrdp.ini && \
    sed -i 's/xrdp1/hfuser/g' /etc/xrdp/xrdp.ini && \
    mkdir -p /var/run/xrdp /var/log/xrdp && \
    chmod -R 777 /var/run/xrdp /var/log/xrdp /etc/xrdp

# User switch karna
USER hfuser
WORKDIR /home/hfuser

# Xsession setup karna desktop environment ke liye
RUN echo "startlxde" > /home/hfuser/.xsession && \
    chmod +x /home/hfuser/.xsession

# Startup script ko copy aur configure karna
COPY --chown=hfuser:hfuser start.sh /home/hfuser/start.sh
RUN chmod +x /home/hfuser/start.sh

# Hugging Face default port 7860 use karta hai
EXPOSE 7860

# Container start hone par ye script chalegi
CMD ["./start.sh"]