1 # Copyright 2018 Huawei Technologies Co., Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 FROM openjdk:8-jre-slim
17 ENV OPEN_CLI_HOME=/opt/oclip \
18 OPEN_CLI_DEBUG=false \
19 OPEN_CLI_DEBUG_PORT=5005 \
20 OPEN_CLI_MODE=console \
21 OPEN_CLI_PRODUCT_IN_USE=onap-beijing \
22 GOTTY_TITLE_FORMAT="{{ .command }}"
24 ADD ./STAGE $OPEN_CLI_HOME
25 WORKDIR $OPEN_CLI_HOME
27 RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \
28 cd /tmp && curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz && \
29 tar -xvf go1.9.linux-amd64.tar.gz && mkdir -p /tmp/gotty && \
30 GOPATH=/tmp/gotty /tmp/go/bin/go get github.com/yudai/gotty && \
31 mv /tmp/gotty/bin/gotty /usr/sbin/ && \
32 pandoc -t plain $OPEN_CLI_HOME/docs/README.md > $OPEN_CLI_HOME/docs/oclip-readme.txt && \
33 apt-get purge -y pandoc && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/go /tmp/gotty /tmp/* /var/tmp/* && \
34 chmod +x $OPEN_CLI_HOME/bin/oclip.sh && \
35 ln $OPEN_CLI_HOME/bin/oclip.sh /usr/sbin/oclip && \
36 ln $OPEN_CLI_HOME/bin/oclip.sh /usr/sbin/onap && \
37 if [ ! -d $OPEN_CLI_HOME/data ]; then mkdir $OPEN_CLI_HOME/data; fi && \
38 if [ ! -d $OPEN_CLI_HOME/open-cli-schema ]; then mkdir $OPEN_CLI_HOME/open-cli-schema; fi && \
39 if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi && \
40 cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/ && \
41 cp $OPEN_CLI_HOME/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf && \
42 if [ ! -d /var/www-data/servers/open-cli/ ]; then mkdir -p /var/www-data/servers/open-cli/; fi && \
43 cp $OPEN_CLI_HOME/http/web/*.* /var/www-data/servers/open-cli/ && \
44 cp $OPEN_CLI_HOME/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/ && \
45 cp $OPEN_CLI_HOME/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip
49 ENTRYPOINT if [ "$OPEN_CLI_MODE" = "daemon" ]; then service lighttpd start; gotty --permit-write --reconnect oclip; else oclip -v && /bin/bash; fi