mirror of
https://gitee.com/kennylee/docker.git
synced 2024-11-29 18:38:34 +08:00
添加ci-html应用环境,用来展示项目中的静态页面到服务器上,并且持续更新。
This commit is contained in:
parent
c321f83f5a
commit
b09922711f
25
ci-html/Dockerfile
Normal file
25
ci-html/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/kennylee/alpine
|
||||
|
||||
MAINTAINER kennylee26 <kennylee26@gmail.com>
|
||||
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache git openssh
|
||||
|
||||
ENV HOME /root
|
||||
ENV local_repo=$HOME/html_repo\
|
||||
repo_remote=http://sys:11111111@192.168.3.231:10080/zgbj/gkxt.git\
|
||||
repo_branch=feature_frontend\
|
||||
www_for_repo=common/src/main/webapp
|
||||
|
||||
VOLUME /usr/share/nginx/html
|
||||
|
||||
RUN git clone $repo_remote $local_repo
|
||||
RUN cd $local_repo && \
|
||||
git checkout $repo_branch
|
||||
|
||||
WORKDIR $HOME
|
||||
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod +x /run.sh
|
||||
|
||||
CMD ["/run.sh"]
|
23
ci-html/README.md
Normal file
23
ci-html/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Ci-HTML
|
||||
|
||||
前后端分离的开发情况下,为了方便业务人员进行查看前端页面,需要用来持续集成到git上某分支上的html内容到到http服务器上。
|
||||
|
||||
## 说明
|
||||
|
||||
Dockerfile上有几个重要的环境参数,可以根据实际情况进行修改,建议使用docker-compose来传递这些参数
|
||||
|
||||
* local\_repo
|
||||
|
||||
本地保存的路径,一般情况下不用修改
|
||||
|
||||
* repo\_remote
|
||||
|
||||
远程分支服务器的下载地址,需要验证时,可把账户密码传递进去。
|
||||
|
||||
* repo\_branch
|
||||
|
||||
项目的分支
|
||||
|
||||
* www\_for\_repo
|
||||
|
||||
项目下静态文件的相对路径。
|
22
ci-html/docker-compose.yml
Normal file
22
ci-html/docker-compose.yml
Normal file
@ -0,0 +1,22 @@
|
||||
version: '2'
|
||||
services:
|
||||
html_data:
|
||||
image: busybox
|
||||
container_name: 'web-data'
|
||||
volumes:
|
||||
- /usr/share/nginx/html
|
||||
git:
|
||||
build: .
|
||||
container_name: 'web-data-fetch'
|
||||
volumes_from:
|
||||
- html_data
|
||||
restart: always
|
||||
serv:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/kennylee/nginx:alpine-1.11
|
||||
container_name: 'web-server'
|
||||
ports:
|
||||
- "8088:80"
|
||||
volumes_from:
|
||||
- html_data
|
||||
restart: always
|
||||
|
9
ci-html/run.sh
Normal file
9
ci-html/run.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
|
||||
while [ true ]
|
||||
do
|
||||
git fetch
|
||||
rm -rf /usr/share/nginx/html/*
|
||||
cp -r $local_repo/$www_for_repo/* /usr/share/nginx/html
|
||||
sleep 5m
|
||||
done
|
Loading…
Reference in New Issue
Block a user