瀏覽代碼

adding some libraries for flask application

* opening up port in docker image for flask test server
clementinecomputing 5 年之前
父節點
當前提交
59cd78dc92
共有 2 個文件被更改,包括 49 次插入15 次删除
  1. 6 3
      server/docker/Dockerfile
  2. 43 12
      server/docker/run_interactive.sh

+ 6 - 3
server/docker/Dockerfile

@@ -11,11 +11,14 @@ RUN \
   apt-get install -y gcc perl \
     git openssh-server sqlite3 libdbd-sqlite3-perl \
     default-mysql-server apache2 \
-    netcat telnet wget \
+    netcat telnet wget python3-flask python3-pymysql python3-pip \
     mariadb-server
 
 RUN \
-  apt-get install -y libswitch-perl libdate-calc-perl
+  apt-get install -y libswitch-perl libdate-calc-perl bson python3-pymongo
+
+RUN \
+  pip3 install flask-restful
 
 RUN \
   useradd -m bus && \
@@ -67,6 +70,6 @@ COPY ./startup_and_persist.sh /root/startup_and_persist.sh
 RUN \
   chmod u+x /root/startup_and_persist.sh
 
-EXPOSE 80 22 443 6055 2857 7277 2455 3556 8377
+EXPOSE 80 22 443 6055 2857 7277 2455 3556 8377 5000
 
 CMD ["/root/startup_and_persist.sh"]

+ 43 - 12
server/docker/run_interactive.sh

@@ -1,8 +1,12 @@
 #!/bin/bash
 
+export DEBUG="1"
+
 #export uname="bus"
 export uname="root"
 
+export mountdir="$1"
+
 export SSH_DEFAULT_PORT="6055"
 export AVLS_DAEMON_PORT="2857"
 export PASSDB_DAEMON_PORT="7277"
@@ -10,23 +14,49 @@ export BILLDB_DAEMON_PORT="2455"
 export HELLO_DAEMON_PORT="3556"
 export UPDATE_DAEMON_PORT="8377"
 
+export DEBUG_PORT="5000"
+
+export mountparam=""
+
+if [[ "$mountdir" != "" ]] ; then
+  mountparam="-v $mountdir:/data"
+  echo "$mountparam"
+fi
+
 ## for interactive debugging...
 ##
 if [[ "$uname" == "root" ]] ; then
 
-  docker run  \
-    -p 8080:80 \
-    -p 4430:443 \
-    -p $SSH_DEFAULT_PORT:22 \
-    -p $AVLS_DAEMON_PORT:$AVLS_DAEMON_PORT \
-    -p $PASSDB_DAEMON_PORT:$PASSDB_DAEMON_PORT \
-    -p $BILLDB_DAEMON_PORT:$BILLDB_DAEMON_PORT \
-    -p $HELLO_DAEMON_PORT:$HELLO_DAEMON_PORT \
-    -p $UPDATE_DAEMON_PORT:$UPDATE_DAEMON_PORT \
-    -it popufare \
-    /bin/bash
+  if [[ "$DEBUG" == "1" ]] ; then
+    docker run  $mountparam \
+      -p $DEBUG_PORT:$DEBUG_PORT \
+      -p 8080:80 \
+      -p 4430:443 \
+      -p $SSH_DEFAULT_PORT:22 \
+      -p $AVLS_DAEMON_PORT:$AVLS_DAEMON_PORT \
+      -p $PASSDB_DAEMON_PORT:$PASSDB_DAEMON_PORT \
+      -p $BILLDB_DAEMON_PORT:$BILLDB_DAEMON_PORT \
+      -p $HELLO_DAEMON_PORT:$HELLO_DAEMON_PORT \
+      -p $UPDATE_DAEMON_PORT:$UPDATE_DAEMON_PORT \
+      -it popufare \
+      /bin/bash
+  else
+    docker run \
+      -p 8080:80 \
+      -p 4430:443 \
+      -p $SSH_DEFAULT_PORT:22 \
+      -p $AVLS_DAEMON_PORT:$AVLS_DAEMON_PORT \
+      -p $PASSDB_DAEMON_PORT:$PASSDB_DAEMON_PORT \
+      -p $BILLDB_DAEMON_PORT:$BILLDB_DAEMON_PORT \
+      -p $HELLO_DAEMON_PORT:$HELLO_DAEMON_PORT \
+      -p $UPDATE_DAEMON_PORT:$UPDATE_DAEMON_PORT \
+      -it popufare \
+      /bin/bash
+  fi
+
 else
-  docker run  \
+
+  docker run  $mountparam \
     -p 8080:80 \
     -p 4430:443 \
     -p $SSH_DEFAULT_PORT:22 \
@@ -37,4 +67,5 @@ else
     -p $UPDATE_DAEMON_PORT:$UPDATE_DAEMON_PORT \
     -it popufare \
     bash -c " service ssh start && su - bus "
+
 fi