U - 更新文档以及Dockerfile

pull/15/head
张玉坡 2019-08-09 17:03:24 +08:00
parent 7163f62cc7
commit 369ccd2825
4 changed files with 17 additions and 7 deletions

View File

@ -36,14 +36,14 @@ Spug是一款使用Python+Flask+Vue+Element组件开发的开源运维管理系
### 快速启动
----------------------------
```
$ docker pull hub.qbangmang.com/spug
$ docker pull reg.qiniu.com/openspug/spug
$ docker run -d -p 80:80 hub.qbangmang.com/spug
$ 访问http://主机ip
$ 默认账号密码admin/spug
# 可选参数:
$ docker run -d -e REGISTRY_SERVER="hub.qbangmang.com" -p 80:80 hub.qbangmang.com/spug
$ docker run -d -e REGISTRY_SERVER="hub.qbangmang.com" -p 80:80 reg.qiniu.com/openspug/spug
$ -e MYSQL_HOST = "192.168.1.10" // 指定数据库地址
-e MYSQL_DATABASE="spug" // 指定数据库名称,

View File

@ -1,12 +1,15 @@
FROM python:3.6-alpine
ENV VERSION=1.0.5
RUN echo -e "http://mirrors.aliyun.com/alpine/v3.9/main\nhttp://mirrors.aliyun.com/alpine/v3.9/community" > /etc/apk/repositories
RUN apk update && apk add --no-cache nginx mariadb nodejs-npm git
RUN echo -e "http://mirrors.aliyun.com/alpine/v3.10/main\nhttp://mirrors.aliyun.com/alpine/v3.10/community" > /etc/apk/repositories
RUN apk update && apk add --no-cache nginx mariadb nodejs-npm git
RUN apk add --no-cache --virtual .build-deps openssl-dev gcc musl-dev python3-dev libffi-dev openssl-dev make
RUN git clone https://github.com/openspug/spug.git --depth=1 /spug && cd /spug && git pull
RUN echo $VERSION && git clone https://github.com/openspug/spug.git --depth=1 /spug && cd /spug && git pull
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && pip install --upgrade pip && pip install --no-cache-dir -r /spug/spug_api/requirements.txt \
&& pip install --no-cache-dir gunicorn \
&& apk del .build-deps
RUN cd /spug/spug_web/ && npm i && npm run build \
&& mv /spug/spug_web/dist /var/www/
@ -14,4 +17,4 @@ ADD default.conf /etc/nginx/conf.d/default.conf
ADD entrypoint.sh /entrypoint.sh
ADD scripts /scripts
ENTRYPOINT ["sh", "/entrypoint.sh"]
ENTRYPOINT ["sh", "/entrypoint.sh"]

5
docs/Dockerfile/pip.conf Normal file
View File

@ -0,0 +1,5 @@
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

View File

@ -11,7 +11,9 @@ DOCKER_URL = 'unix:///var/run/docker.sock'
SQLALCHEMY_ECHO = False
EOF
echo "SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://${MYSQL_USER:-spuguser}:${MYSQL_PASSWORD:-spugpwd}@${MYSQL_HOST:-localhost}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-spug}?unix_socket=/run/mysqld/mysqld.sock'" >> /spug/spug_api/config.py
# echo "SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://${MYSQL_USER:-spuguser}:${MYSQL_PASSWORD:-spugpwd}@${MYSQL_HOST:-localhost}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-spug}?unix_socket=/run/mysqld/mysqld.sock'" >> /spug/spug_api/config.py
echo "SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://${MYSQL_USER:-spuguser}:${MYSQL_PASSWORD:-spugpwd}@${MYSQL_HOST:-localhost}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-spug}'" >> /spug/spug_api/config.py
echo "DOCKER_REGISTRY_SERVER = '${REGISTRY_SERVER:-hub.qbangmang.com}'" >> /spug/spug_api/config.py
echo "DOCKER_REGISTRY_AUTH = {'username': '${REGISTRY_USER}', 'password': '${REGISTRY_PASSWORD}'}" >> /spug/spug_api/config.py