浏览代码

docker multi stage build update

kevin 2 年之前
父节点
当前提交
3e060f5f65
共有 4 个文件被更改,包括 10 次插入7 次删除
  1. 1 1
      Dockerfile
  2. 2 0
      docker-compose.yaml
  3. 0 4
      fr_flask.py
  4. 7 2
      gunicorn.conf.py

+ 1 - 1
Dockerfile

@@ -1,6 +1,6 @@
 FROM fr_req AS fr
 
-WORKDIR /usr/src/app
+COPY . .
 
 EXPOSE 8349
 

+ 2 - 0
docker-compose.yaml

@@ -12,6 +12,8 @@ services:
     volumes:
       - ./mysql:/var/lib/mysql
       - ./sql:/docker-entrypoint-initdb.d
+#    ports:
+#      - "5050:5050"
   web:
     build:
       context: .

+ 0 - 4
fr_flask.py

@@ -290,10 +290,6 @@ def predict():
                     "proba": 0.0,
                     "delta": 0.0
                 }
-            print(total[0][i] > total_threshold)
-            print(not db_result)
-            print(i == no - 1)
-            print((not db_result and i == no - 1))
             if total[0][i] > total_threshold or (not db_result and i == no - 1):
                 db_result.append(js)
             end_time = time.perf_counter()

+ 7 - 2
gunicorn.conf.py

@@ -5,11 +5,16 @@ bind = '0.0.0.0:8349'
 workers = os.environ.get("WORKERS", "2")
 timeout = os.environ.get("TIMEOUT", "180")
 preload_app = True
+enable_stdio_inheritance = True
+loglevel = 'debug'
+accesslog = '-'
+pidfile = "app.pid"
+
 def on_starting(server):
     worker_count = int(workers)
 
-    # Insert a 2-second gap between workers
-    gap_duration = 2
+    # Insert a 1-second gap between workers
+    gap_duration = 1
 
     for i in range(worker_count):
         # Add a delay between each worker