自动部署静态页面
This commit is contained in:
parent
6c1a3397fc
commit
30737f669f
@ -1,16 +1,16 @@
|
||||
# redis 搭建
|
||||
# dynamic 搭建
|
||||
## 创建镜像
|
||||
|
||||
镜像构建源码请[参考](http://git.yangyufans.com/pub/docker/tree/master/redis)
|
||||
|
||||
```bash
|
||||
docker build -t ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 .
|
||||
docker build -t ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1 .
|
||||
```
|
||||
|
||||
## 从远程仓库下拉
|
||||
|
||||
```bash
|
||||
docker pull ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10
|
||||
docker pull ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1
|
||||
```
|
||||
|
||||
## 创建容器
|
||||
@ -19,6 +19,7 @@ docker pull ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10
|
||||
docker run -d \
|
||||
--privileged=true \
|
||||
-p 6379:6379 \
|
||||
-p 16379:16379 \
|
||||
-v /data/redis/conf:/redis/conf \
|
||||
-v /data/redis/logs:/redis/logs \
|
||||
-v /data/redis/data:/redis/data \
|
||||
|
||||
27
site/Dockerfile
Normal file
27
site/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM centos:7
|
||||
|
||||
MAINTAINER Yang <yangyufans@qq.com>
|
||||
|
||||
ENV NGINX_VERSION=1.15.0
|
||||
|
||||
RUN yum install -y wget make gcc pcre-devel gzip zlib zlib-devel
|
||||
|
||||
RUN cd / && wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \
|
||||
&& tar -zxvf nginx-$NGINX_VERSION.tar.gz \
|
||||
&& rm -rf nginx-$NGINX_VERSION.tar.gz \
|
||||
&& cd nginx-$NGINX_VERSION \
|
||||
&& ./configure --prefix=/usr/local/nginx \
|
||||
&& make \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
&& rm -rf nginx-$NGINX_VERSION
|
||||
|
||||
RUN mkdir -p /nginx/conf && mkdir /nginx/logs/
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
COPY start.sh /
|
||||
|
||||
RUN chmod 777 /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
||||
17
site/README.md
Normal file
17
site/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# 动态应用部署程序
|
||||
## 部署
|
||||
从git上自动拉取静态页面部署
|
||||
|
||||
## 创建容器
|
||||
```bash
|
||||
docker run -d \
|
||||
--restart always \
|
||||
--privileged=true \
|
||||
-p 8080:80 \
|
||||
-e BRANCH=master \
|
||||
-v $PWD/conf:/nginx/conf \
|
||||
-v $PWD/logs:/nginx/logs \
|
||||
-v $PWD/www:/nginx/www \
|
||||
-e REPOSITORY=http://gitlab+deploy-token-7:xrcYgvemJ3LXLJStSWG8@git.yangyufans.com/yangyufans/hexo-test.git \
|
||||
--name dynamic ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1
|
||||
```
|
||||
27
site/start.sh
Normal file
27
site/start.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -e /nginx/conf/nginx.conf ]; then
|
||||
cp /usr/local/nginx/conf/nginx.conf /nginx/conf
|
||||
sed -i "s/mime.types/\/usr\/local\/nginx\/conf\/mime.types/" /nginx/conf/nginx.conf
|
||||
sed -i "s/#error_log logs\/error.log;/error_log \/nginx\/logs\/error.log;/" /nginx/conf/nginx.conf
|
||||
sed -i "s/#error_log logs\/error.log notice;/error_log \/nginx\/logs\/error.log notice;/" /nginx/conf/nginx.conf
|
||||
sed -i "s/#error_log logs\/error.log info;/error_log \/nginx\/logs\/error.log info;/" /nginx/conf/nginx.conf
|
||||
sed -i "s/#pid logs\/nginx.pid;/pid \/nginx\/logs\/nginx.pid;/" /nginx/conf/nginx.conf
|
||||
sed -i "s/root html;/root \/nginx\/www\/dynamic;/" /nginx/conf/nginx.conf
|
||||
fi
|
||||
|
||||
if [ ! -e /nginx/www/dynamic ]; then
|
||||
cd /nginx/www;
|
||||
git clone -b $BRANCH $REPOSITORY dynamic;
|
||||
fi
|
||||
|
||||
/usr/local/nginx/sbin/nginx -c /nginx/conf/nginx.conf
|
||||
|
||||
while true;
|
||||
do
|
||||
cd /nginx/www;
|
||||
git fetch --all > /dev/null 2>&1 ;
|
||||
git reset --hard origin/$BRANCH > /dev/null 2>&1 ;
|
||||
git pull > /dev/null 2>&1 ;
|
||||
sleep 5;
|
||||
done
|
||||
Loading…
Reference in New Issue
Block a user