Bladeren bron

update docker-compose

Alenx 6 jaren geleden
bovenliggende
commit
5d0b7c1798
3 gewijzigde bestanden met toevoegingen van 24 en 13 verwijderingen
  1. 2 0
      Dockerfile
  2. 15 13
      docker-compose.yml
  3. 7 0
      walle.env

+ 2 - 0
Dockerfile

@@ -1,5 +1,7 @@
 FROM python:2.7
 
+MAINTAINER from Alenx<alenx.hai@live.com>
+
 RUN mkdir /opt/walle-web && mkdir -p /data/walle
 
 ADD ./requirements/prod.txt /usr/app/

+ 15 - 13
docker-compose.yml

@@ -1,15 +1,16 @@
+# docker version:  18.06.0+
+# docker-compose version: 1.23.2+
+# OpenSSL version: OpenSSL 1.1.0h
 version: '3.7'
 services:
   web:
-    image: alenx/walle-web:2.0
+    image: alenx/walle-web:2.1
     container_name: walle-nginx
     hostname: nginx-web
     ports:
     # 如果宿主机80端口被占用,可自行修改为其他port(>=1024)
     # 0.0.0.0:要绑定的宿主机端口:docker容器内端口80
       - "80:80"
-    links:
-      - python
     depends_on:
       - python
     networks:
@@ -17,18 +18,19 @@ services:
     restart: always
 
   python:
-    image: alenx/walle-python:2.0
+    image: alenx/walle-python:2.1
     container_name: walle-python
     hostname: walle-python
+    env_file:
+      # walle.env需和docker-compose在同级目录
+      - ./walle.env
     volumes:
       - /tmp/walle/codebase/:/tmp/walle/codebase/
       - /tmp/walle/logs/:/opt/walle-web/logs/
       - /root/.ssh:/root/.ssh/
-    command: bash -c "cd /opt/walle-web/ && /bin/bash admin.sh migration && python /opt/walle-web/waller.py"
+    command: bash -c "cd /opt/walle-web/ && /bin/bash admin.sh migration &&  python waller.py"
     expose:
       - "5000"
-    links: 
-      - db
     depends_on:
       - db
     networks:
@@ -39,14 +41,14 @@ services:
     image: mysql
     container_name: walle-mysql
     hostname: walle-mysql
+    env_file:
+      # walle.env需和docker-compose在同级目录
+      - ./walle.env
+    command: [ '--default-authentication-plugin=mysql_native_password', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
     ports:
       - "3306:3306"
-    expose:
-      - "3306"
-    command: --default-authentication-plugin=mysql_native_password
-    environment:
-      MYSQL_ROOT_PASSWORD: walle
-      MYSQL_DATABASE: walle
+      expose:
+        - "3306"
     volumes:
       - /data/walle/mysql:/var/lib/mysql
     networks:

+ 7 - 0
walle.env

@@ -0,0 +1,7 @@
+# Set MySQL/Rails environment
+MYSQL_USER=root
+MYSQL_PASSWORD=walle
+MYSQL_DATABASE=walle
+MYSQL_ROOT_PASSWORD=walle
+MYSQL_HOST=db
+MYSQL_PORT=3306