瀏覽代碼

update admin.sh(自动安装pip)

Alenx 6 年之前
父節點
當前提交
81242c69d1
共有 2 個文件被更改,包括 9 次插入16 次删除
  1. 4 3
      admin.sh
  2. 5 13
      docker-compose.yml

+ 4 - 3
admin.sh

@@ -13,7 +13,8 @@ function init() {
     echo "----------------"
     which pip
     if [ $? != "0" ]; then
-        exit 1
+        wget https://bootstrap.pypa.io/3.3/get-pip.py
+        python get-pip.py
     fi
     pip install virtualenv
     if [ ! -d "venv" ]; then
@@ -61,15 +62,15 @@ function restart() {
 function upgrade() {
     echo "upgrade walle"
     echo "----------------"
-    cd `dirname $0`
+    cd $(dirname $0)
     echo -e "建议先暂存本地修改\033[33m git stash\033[0m,更新后再弹出\033[33m git stash pop\033[0m,处理冲突。"
+    source venv/bin/activate
     git pull
 }
 
 function migration() {
     echo "migration walle"
     echo "----------------"
-    source venv/bin/activate
     export FLASK_APP=waller.py
     flask db upgrade
     if [ $? == "0" ]; then

+ 5 - 13
docker-compose.yml

@@ -1,14 +1,13 @@
 version: '3.7'
 services:
   web:
-    image: nginx
+    image: alenx/walle-web:2.0
     container_name: walle-nginx
     hostname: nginx-web
     ports:
+    # 如果宿主机80端口被占用,可自行修改为其他port(>=1024)
+    # 0.0.0.0:要绑定的宿主机端口:docker容器内端口80
       - "80:80"
-    volumes:
-      - ./fe/:/opt/walle-web/:ro
-      - ./gateway/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
     links:
       - python
     depends_on:
@@ -18,17 +17,12 @@ services:
     restart: always
 
   python:
-    image: alenx/walle-web
+    image: alenx/walle-python:2.0
     container_name: walle-python
     hostname: walle-python
     volumes:
-      - $PWD/:/opt/walle-web/
       - /tmp/walle/codebase/:/tmp/walle/codebase/
-    environment:
-      WALLE_DB_HOST: db:3306
-      WALLE_DB_USER: user
-      WALLE_DB_PASSWORD: password
-    command: bash -c "/bin/bash /opt/walle-web/admin.sh upgrade && python /opt/walle-web/waller.py"
+    command: bash -c "/bin/bash /opt/walle-web/admin.sh migration && python /opt/walle-web/waller.py"
     expose:
       - "5000"
     links: 
@@ -50,8 +44,6 @@ services:
     command: --default-authentication-plugin=mysql_native_password
     environment:
       MYSQL_ROOT_PASSWORD: walle
-      MYSQL_USER: user
-      MYSQL_PASSWORD: password
       MYSQL_DATABASE: walle
     volumes:
       - /data/walle/mysql:/var/lib/mysql