Merge "Enable feature to disable mock for verify"
[cli.git] / deployment / docker / src / main / docker / Dockerfile
1 FROM openjdk:8-jre-slim
2
3 #Setup default software
4 RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim
5
6 #Setup gotty
7 RUN cd /tmp && curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz && \
8     tar -xvf go1.9.linux-amd64.tar.gz && mkdir -p /tmp/gotty && \
9     GOPATH=/tmp/gotty /tmp/go/bin/go get github.com/yudai/gotty && \
10     mv /tmp/gotty/bin/gotty /usr/sbin/
11
12 #Environments
13 ENV OPEN_CLI_HOME /opt/oclip
14 ENV OPEN_CLI_DEBUG false
15 ENV OPEN_CLI_DEBUG_PORT 5005
16 ENV OPEN_CLI_MODE console
17 ENV OPEN_CLI_PRODUCT_IN_USE open-cli
18
19 ENV GOTTY_TITLE_FORMAT {{ .command }}
20
21 #Copy CLI into docker
22 ADD ./STAGE $OPEN_CLI_HOME
23 WORKDIR $OPEN_CLI_HOME
24
25 #Setup the run time environment (RTE)
26 #RTE: CLI
27 RUN chmod +x ./bin/oclip.sh  && \
28      ln ./bin/oclip.sh /usr/sbin/oclip  && \
29      if [ ! -d ./data ]; then mkdir ./data; fi  && \
30      if [ ! -d ./open-cli-schema ]; then mkdir ./open-cli-schema; fi
31
32 #Create the readable README
33 RUN pandoc -t plain $OPEN_CLI_HOME/docs/README.md > $OPEN_CLI_HOME/docs/oclip-readme.txt
34
35 #RTE: lighttpd
36 COPY ./STAGE/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf
37 COPY ./STAGE/http/web /var/www-data/servers/open-cli/
38 COPY ./STAGE/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/
39 COPY ./STAGE/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip
40
41 RUN if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi
42 RUN cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/
43
44 EXPOSE 80
45
46 #RTE: gotty
47 EXPOSE 8080
48
49 #Start
50 ENTRYPOINT if [ "$OPEN_CLI_MODE" = "daemon" ]; then service lighttpd start; gotty --permit-write --reconnect oclip; else oclip -v && /bin/bash; fi
51
52 #Cleanup
53 RUN 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/*
54
55 RUN echo Open CLI docker successfully created !!