From 12b9558c6af59b3d32b16a5d6792490a5af00a78 Mon Sep 17 00:00:00 2001 From: lihaixin2 Date: Tue, 16 Aug 2016 04:20:11 -0400 Subject: [PATCH] first commit --- Dockerfile | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 21 +++++++++++++++ myrun | 5 ++++ supervisord.conf | 62 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 myrun create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bd1c16a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,66 @@ +FROM ubuntu:16.04 +MAINTAINER Haixin Lee +ENV DEBIAN_FRONTEND noninteractive +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +ENV XYZ 1024x768x16 +ENV TZ "Asia/Shanghai" +ENV VNC_PW "vncpassword" +ENV DISPLAY :0 + + +#升级仓库,安装基本网络包 +RUN apt-get update -y && \ + apt-get install -qqy --no-install-recommends \ + gettext-base wget curl iputils-ping iproute2 mtr apt-utils \ + vim net-tools supervisor + +# 安装基本字体 +RUN apt-get -qqy --no-install-recommends install \ + fonts-ipafont-gothic \ + xfonts-100dpi \ + xfonts-75dpi \ + xfonts-cyrillic \ + xfonts-scalable \ + language-pack-zh-hans \ + ttf-wqy-microhei + +#升级系统,安装必要的包,配置VNC密码 +RUN apt-get -y install xvfb x11vnc fluxbox xdotool git git-core ca-certificates && \ + mkdir ~/.vnc && \ + touch ~/.vnc/passwd + RUN x11vnc -storepasswd $VNC_PW ~/.vnc/passwd + +# 克隆 noVNC和设置novnc首页 +RUN git clone --recursive https://github.com/kanaka/noVNC.git /opt/novnc && \ + git clone --recursive https://github.com/kanaka/websockify.git /opt/novnc/utils/websockify && \ + ln -s /opt/novnc/vnc.html /opt/novnc/index.html + +#安装firefox +RUN echo "deb http://archive.canonical.com/ubuntu/ xenial partner" >> /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends adobe-flashplugin firefox + + +# 升级到最新版本 删除不必要的软件和Apt缓存包列表 +RUN apt-get upgrade --yes && \ + apt-get autoclean && \ + apt-get autoremove && \ + rm -rf /var/lib/apt/lists/* + +# 容器里超级进程管理和配置文件 +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY myrun /usr/bin/myrun +RUN chmod +x /usr/bin/myrun + +# 开放VNC端口和noVNC端口 +# EXPOSE 5900 +EXPOSE 8787 + + +# 运行各种Service + +CMD ["/usr/bin/supervisord"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec4cf24 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +## firefox介绍 + +基于ubuntu:16.04 配置x11和novnc 服务和中文字体,在容器里运行firefox 游览器,已经配置支付flash播放 + +## 用法 + +###运行容器 + + docker run -d -p 5900:5900 -p 8787:8787 --name chromium lihaixin/chromium + +###修改VNC密码 + + docker exec -it chromium /bin/sh -c "x11vnc -storepasswd VNCPASSWORD ~/.vnc/passwd" + + +###如何访问 + + firefox http://:8787 + + vncviewer :5900 + diff --git a/myrun b/myrun new file mode 100644 index 0000000..e7e96d4 --- /dev/null +++ b/myrun @@ -0,0 +1,5 @@ +#!/bin/sh +echo $TZ > /etc/timezone +cp -f /usr/share/zoneinfo/$TZ /etc/localtime +x11vnc -storepasswd $VNC_PW ~/.vnc/passwd + diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..f7ca3c5 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,62 @@ +[supervisord] +nodaemon=true + +[program:X11] +priority=10 +directory=/ +command=/usr/bin/Xvfb :0 -screen 0 %(ENV_XYZ)s +user=root +autostart=true +autorestart=true +stopsignal=QUIT +stdout_logfile=/var/log/xvfb.log +redirect_stderr=true + +[program:x11vnc] +priority=20 +directory=/ +command=x11vnc -display :0 -shared -usepw +user=root +autostart=true +autorestart=true +stopsignal=QUIT +stdout_logfile=/var/log/x11vnc.log +redirect_stderr=true + + +[program:fluxbox] +priority=20 +directory=/ +command=/usr/bin/startfluxbox +user=root +autostart=true +autorestart=true +stopsignal=QUIT +stdout_logfile=/var/log/fluxbox.log +redirect_stderr=true +stopasgroup=true + +[program:novnc] +priority=25 +directory=/opt/novnc +command=/opt/novnc/utils/launch.sh --vnc localhost:5900 --listen 8787 --web /opt/novnc +user=root +autostart=true +autorestart=true +stopsignal=QUIT +stdout_logfile=/var/log/novnc.log +redirect_stderr=true +stopasgroup=true + +[program:myrun] +priority=27 +command=/usr/bin/myrun +autorestart=false +stdout_logfile=/var/log/myrun.log + + +[program:firefox] +priority=30 +command=/usr/bin/firefox https://www.alexamaster.net/autosurf.php?Master=20698 +autorestart=true +stdout_logfile=/var/log/firefox.log