aboutsummaryrefslogtreecommitdiffstats
path: root/standalone/src/main/assembly
diff options
context:
space:
mode:
Diffstat (limited to 'standalone/src/main/assembly')
-rw-r--r--standalone/src/main/assembly/dockerfile50
-rw-r--r--standalone/src/main/assembly/requirements26
-rw-r--r--standalone/src/main/assembly/requirements.txt26
-rwxr-xr-xstandalone/src/main/assembly/run.sh19
4 files changed, 64 insertions, 57 deletions
diff --git a/standalone/src/main/assembly/dockerfile b/standalone/src/main/assembly/dockerfile
index 4203e20..4a8bbc3 100644
--- a/standalone/src/main/assembly/dockerfile
+++ b/standalone/src/main/assembly/dockerfile
@@ -1,27 +1,41 @@
+# hadolint ignore=DL3007
FROM tensorflow/serving:latest
-RUN mkdir -p /home/uuihome/uui
-
WORKDIR /home/uuihome/uui
-RUN groupadd uui -g 1000
-
-RUN useradd -u 1000 -d /home/uuihome/uui -g uui -s /bin/bash uui
-
-RUN DEBIAN_FRONTEND=noninteractive apt-get update
-RUN DEBIAN_FRONTEND=noninteractive apt-get install wget -y
-RUN DEBIAN_FRONTEND=noninteractive apt-get install unzip -y
-
-RUN DEBIAN_FRONTEND=noninteractive apt-get install python3-pip python3-dev build-essential -y
-RUN ln -s /usr/bin/python3 /usr/bin/python
-RUN ln -s /usr/bin/pip3 /usr/bin/pip
-
-COPY requirements /home/uuihome/uui/requirements
-RUN DEBIAN_FRONTEND=noninteractive pip install -r requirements
-COPY scripts /home/uuihome/uui/scripts
+COPY requirements.txt /home/uuihome/uui/requirements.txt
+
+# hadolint ignore=DL3008
+RUN groupadd uui -g 1000 && \
+ useradd -u 1000 -d /home/uuihome/uui -g uui -s /bin/bash uui && \
+ DEBIAN_FRONTEND=noninteractive apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
+ build-essential \
+ curl \
+ python3-dev \
+ python3-pip \
+ unzip && \
+ curl -LO https://github.com/google-research/bert/archive/master.zip && \
+ curl -LO https://storage.googleapis.com/bert_models/2018_10_18/uncased_L-12_H-768_A-12.zip && \
+ unzip master.zip && \
+ unzip uncased_L-12_H-768_A-12.zip && \
+ rm master.zip uncased_L-12_H-768_A-12.zip && \
+ ln -s /usr/bin/python3 /usr/bin/python && \
+ ln -s /usr/bin/pip3 /usr/bin/pip && \
+ pip install --no-cache-dir -r requirements.txt && \
+ DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y \
+ build-essential \
+ curl \
+ python3-dev \
+ unzip && \
+ DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+COPY scripts /home/uuihome/uui/bert-master/
COPY run.sh /home/uuihome/uui/run.sh
RUN chown -R uui:uui /home/uuihome/uui
USER uui
-ENTRYPOINT /home/uuihome/uui/run.sh \ No newline at end of file
+ENTRYPOINT ["/home/uuihome/uui/run.sh"]
diff --git a/standalone/src/main/assembly/requirements b/standalone/src/main/assembly/requirements
deleted file mode 100644
index 4c87302..0000000
--- a/standalone/src/main/assembly/requirements
+++ /dev/null
@@ -1,26 +0,0 @@
-entrypoints==0.3
-Flask==1.1.1
-future==0.17.1
-joblib==0.13.2
-json5==0.8.4
-jsonschema==3.0.1
-Keras-Applications==1.0.8
-Keras-Preprocessing==1.1.0
-lxml==4.3.4
-matplotlib==3.1.0
-numpy==1.16.4
-numpydoc==0.9.1
-openpyxl==2.6.2
-pandas==0.24.2
-protobuf==3.13.0
-requests==2.22.0
-scikit-learn==0.21.2
-setuptools==41.0.1
-six==1.12.0
-tensorboard==1.14.0
-tensorflow==1.14.0
-tensorflow-estimator==1.14.0
-urllib3==1.24.2
-xlrd==1.2.0
-XlsxWriter==1.1.8
-xlwt==1.3.0 \ No newline at end of file
diff --git a/standalone/src/main/assembly/requirements.txt b/standalone/src/main/assembly/requirements.txt
new file mode 100644
index 0000000..10b5589
--- /dev/null
+++ b/standalone/src/main/assembly/requirements.txt
@@ -0,0 +1,26 @@
+entrypoints==0.3
+Flask==1.1.1
+future==0.17.1
+joblib==0.13.2
+json5==0.8.4
+jsonschema==3.0.1
+Keras-Applications==1.0.8
+Keras-Preprocessing==1.1.0
+lxml==4.3.4
+matplotlib==3.1.0
+numpy==1.16.4
+numpydoc==0.9.1
+openpyxl==2.6.2
+pandas==0.24.2
+protobuf==3.13.0
+requests==2.22.0
+scikit-learn==0.21.2
+setuptools==41.0.1
+six==1.12.0
+tensorboard==1.14.0
+tensorflow==1.14.0
+tensorflow-estimator==1.14.0
+urllib3==1.24.2
+xlrd==1.2.0
+XlsxWriter==1.1.8
+xlwt==1.3.0
diff --git a/standalone/src/main/assembly/run.sh b/standalone/src/main/assembly/run.sh
index 94b4afa..ad7a946 100755
--- a/standalone/src/main/assembly/run.sh
+++ b/standalone/src/main/assembly/run.sh
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Copyright 2016-2017 ZTE Corporation.
+# Copyright 2021 Orange.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,19 +16,11 @@
# limitations under the License.
#
-cd /home/uuihome/uui/
-wget https://github.com/google-research/bert/archive/master.zip
-wget https://storage.googleapis.com/bert_models/2018_10_18/uncased_L-12_H-768_A-12.zip
+cd /home/uuihome/uui/bert-master/ || exit
-unzip master.zip
-unzip uncased_L-12_H-768_A-12.zip
-rm master.zip uncased_L-12_H-768_A-12.zip
-cp scripts/* bert-master/
-cd /home/uuihome/uui/bert-master/
-
-mkdir upload
-nohup python -u api_squad_online.py 33011 > online.log 2>&1 &
-nohup python -u api_squad_offline.py 33012 > offline.log 2>&1 &
-nohup python -u upload.py 33013 > upload.log 2>&1 &
+mkdir -p upload
+nohup sh -c 'python -u api_squad_online.py 33011 2>&1 | tee online.log' | tee nohup.out &
+nohup sh -c 'python -u api_squad_offline.py 33012 2>&1 | tee offline.log' | tee nohup.out &
+nohup sh -c 'python -u upload.py 33013 2>&1 | tee upload.log' | tee nohup.out &
/usr/bin/tf_serving_entrypoint.sh