Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ccav14 committed Apr 6, 2016
0 parents commit 17e5153
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 0 deletions.
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 这是迅雷云监工的docker程序
# 云监工原作者powergx

FROM tutum/ubuntu:trusty
MAINTAINER sanzuwu <[email protected]>

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

#设置时区为北京时区
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#设置时区服务器
#RUN ntpdate ntp1.aliyun.com

#更新,安装git,wget,sudo
RUN apt-get update && apt-get install -y git wget sudo vim nginx curl

#创建工作目录
RUN mkdir /app
RUN cd /app
#下载云监工源代码
RUN git clone https://github.com/sanzuwu/crysadm.git
#添加计划任务每小时运行云监工
#RUN echo '0 * * * * root sh /app/crysadm/run.sh' >> /etc/crontab

#安装python,redis
RUN apt-get install -y python3.4 python3.4-dev redis-server
RUN chmod +x ./crysadm/get-pip.py
RUN python3.4 ./crysadm/get-pip.py
RUN pip3.4 install redis && sudo pip3.4 install requests && sudo pip3.4 install flask

#复制配置文件
RUN mv /etc/nginx/sites-available/default ./
COPY default /etc/nginx/sites-available/
RUN apt-get clean

#脚本加运行权限
RUN chmod +x ./crysadm/run.sh ./crysadm/down.sh ./crysadm/setup.sh ./crysadm/cron.sh
#redis数据库保存目录
VOLUME ["/var/lib/redis"]

#设置容器端口
#设置反向代理端口
EXPOSE 80
#云监工端口
EXPOSE 4000
#ssh端口
EXPOSE 22

WORKDIR /app

RUN chmod +w /set_root_pw.sh
#添加运行脚本
RUN echo "/app/crysadm/run.sh" >>/set_root_pw.sh
#RUN echo "cron start" >>/set_root_pw.sh
RUN echo "service nginx start" >>/set_root_pw.sh
RUN echo "service nginx reload" >>/set_root_pw.sh
RUN echo "/bin/bash" >>/set_root_pw.sh

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 这是迅雷云监工docker杂交版
# 感谢云监工原作者powergx,感谢sanzuwu,感谢HuiMi24

86 changes: 86 additions & 0 deletions default
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:4000/;

}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}

0 comments on commit 17e5153

Please sign in to comment.