diff --git a/Dockerfile b/Dockerfile index dca63956..c3ec99e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,18 @@ -FROM ubuntu:14.04 +FROM ubuntu:16.04 MAINTAINER Doro Wu ENV DEBIAN_FRONTEND noninteractive -ENV HOME /home/ubuntu RUN sed -i 's#http://archive.ubuntu.com/#http://tw.archive.ubuntu.com/#' /etc/apt/sources.list # built-in packages RUN apt-get update \ - && apt-get install -y --force-yes --no-install-recommends software-properties-common curl \ - && sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' >> /etc/apt/sources.list.d/arc-theme.list" \ - && curl -SL http://download.opensuse.org/repositories/home:Horst3180/xUbuntu_16.04/Release.key | sudo apt-key add - \ + && apt-get install -y --no-install-recommends software-properties-common curl \ + && sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' >> /etc/apt/sources.list.d/arc-theme.list" \ + && curl -SL http://download.opensuse.org/repositories/home:Horst3180/xUbuntu_16.04/Release.key | apt-key add - \ && add-apt-repository ppa:fcwu-tw/ppa \ && apt-get update \ - && apt-get install -y --force-yes --no-install-recommends \ + && apt-get install -y --no-install-recommends --allow-unauthenticated \ supervisor \ openssh-server pwgen sudo vim-tiny \ net-tools \ @@ -26,6 +25,7 @@ RUN apt-get update \ python-pip python-dev build-essential \ mesa-utils libgl1-mesa-dri \ gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine pinta arc-theme \ + dbus-x11 x11-utils \ && apt-get autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* @@ -41,4 +41,6 @@ RUN pip install setuptools wheel && pip install -r /usr/lib/web/requirements.txt EXPOSE 80 WORKDIR /root +ENV HOME=/home/ubuntu \ + SHELL=/bin/bash ENTRYPOINT ["/startup.sh"] diff --git a/image/etc/supervisor/conf.d/supervisord.conf b/image/etc/supervisor/conf.d/supervisord.conf index 168cafa1..0b1c0266 100644 --- a/image/etc/supervisor/conf.d/supervisord.conf +++ b/image/etc/supervisor/conf.d/supervisord.conf @@ -11,16 +11,40 @@ redirect_stderr=true [program:lxsession] priority=15 -directory=/home/ubuntu -command=/usr/bin/lxsession +directory=/root +command=/usr/bin/openbox user=root autostart=true autorestart=true stopsignal=QUIT -environment=DISPLAY=":1",HOME="/home/ubuntu" -stdout_logfile=/var/log/lxsession.log +environment=DISPLAY=":1",HOME="/root",USER="root" +stdout_logfile=/var/log/openbox.log redirect_stderr=true +[program:lxpanel] +priority=15 +directory=/root +command=/usr/bin/lxpanel --profile LXDE +user=root +autostart=true +autorestart=true +stopsignal=QUIT +environment=DISPLAY=":1",HOME="/root",USER="root" +stdout_logfile=/var/log/lxpanel.log +redirect_stderr=true + +[program:pcmanfm] +priority=15 +directory=/root +command=/usr/bin/pcmanfm --desktop --profile LXDE +user=root +autostart=true +autorestart=true +stopsignal=QUIT +environment=DISPLAY=":1",HOME="/root",USER="root" +stdout_logfile=/var/log/pcmanfm.log + + [program:x11vnc] priority=20 directory=/ diff --git a/image/home/ubuntu/.gtkrc-2.0 b/image/root/.gtkrc-2.0 similarity index 93% rename from image/home/ubuntu/.gtkrc-2.0 rename to image/root/.gtkrc-2.0 index 6b8def9c..e41091cd 100644 --- a/image/home/ubuntu/.gtkrc-2.0 +++ b/image/root/.gtkrc-2.0 @@ -17,4 +17,4 @@ gtk-xft-antialias=1 gtk-xft-hinting=1 gtk-xft-hintstyle="hintslight" gtk-xft-rgba="rgb" -include "/home/ubuntu/.gtkrc-2.0.mine" +include "/root/.gtkrc-2.0.mine" diff --git a/image/startup.sh b/image/startup.sh index c15fec4f..a7f413a2 100755 --- a/image/startup.sh +++ b/image/startup.sh @@ -2,21 +2,16 @@ mkdir -p /var/run/sshd -# create an ubuntu user -# PASS=`pwgen -c -n -1 10` -PASS=ubuntu -# echo "Username: ubuntu Password: $PASS" -id -u ubuntu &>/dev/null || useradd --create-home --shell /bin/bash --user-group --groups adm,sudo ubuntu -echo "ubuntu:$PASS" | chpasswd -chown -R ubuntu:ubuntu /home/ubuntu -sudo -u ubuntu -i bash -c "mkdir -p /home/ubuntu/.config/pcmanfm/LXDE/ \ - && cp /usr/share/doro-lxde-wallpapers/desktop-items-0.conf /home/ubuntu/.config/pcmanfm/LXDE/" +chown -R root:root /root +mkdir -p /root/.config/pcmanfm/LXDE/ +cp /usr/share/doro-lxde-wallpapers/desktop-items-0.conf /root/.config/pcmanfm/LXDE/ if [ -n "$VNC_PASSWORD" ]; then echo -n "$VNC_PASSWORD" > /.password1 x11vnc -storepasswd $(cat /.password1) /.password2 chmod 400 /.password* sed -i 's/^command=x11vnc.*/& -rfbauth \/.password2/' /etc/supervisor/conf.d/supervisord.conf + export VNC_PASSWORD= fi cd /usr/lib/web && ./run.py > /var/log/web.log 2>&1 & diff --git a/image/usr/lib/web/lightop/__init__.py b/image/usr/lib/web/lightop/__init__.py index 8e2e19f1..c117c03d 100644 --- a/image/usr/lib/web/lightop/__init__.py +++ b/image/usr/lib/web/lightop/__init__.py @@ -112,7 +112,7 @@ def redirectme(): # check all running for i in xrange(20): output = subprocess.check_output(r"supervisorctl status | grep RUNNING | wc -l", shell=True) - if output.strip() == "4": + if output.strip() == "6": FIRST = False return HTML_REDIRECT time.sleep(2)