# This is spring boot config server
# Version 2.1

FROM openjdk:8u212-jdk-alpine

MAINTAINER xiusong.xie@northking.net

EXPOSE 8112


ENV APP_NAME=cctp-attachment
ENV APP_VERSION=1.0.1-RELEASE

ENV CCTP_HOME /home/cctp

ARG SPACE
ARG URL
ARG SIZE
ARG PROFILE
ENV NACOS_SPACE=$SPACE
ENV NACOS_URL=$URL
ENV XMX=$SIZE
ENV APP_PROFILE=$PROFILE

ENV JAR_FILE=${CCTP_HOME}/${APP_NAME}-${APP_VERSION}.ms.jar
ENV TRACE_JAVAAGENT_OPTS='-javaagent:/home/cctp/trace-otel/hzb-otel-javaagent.jar -Dotel.javaagent.configuration-file=/home/cctp/trace-otel/trace-otel.properties'
#ENV JACOCO_AGENT_OPTS='-javaagent:/home/cctp/jacoco-0.8.7/lib/jacocoagent.jar=includes=*,output=tcpserver,port=8040,address=0.0.0.0,append=true'

VOLUME ${CCTP_HOME}

ADD dist ${CCTP_HOME}/
RUN chmod a+x ${CCTP_HOME}/nk-ms.sh

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR ${CCTP_HOME}

ENTRYPOINT ["sh", "-c", "java -jar -Xms${XMX} -Xmx${XMX} ${TRACE_JAVAAGENT_OPTS} -Dfile.encoding=UTF-8 -DAPP_PROFILE=${APP_PROFILE} -DNACOS_NAMESPACE=${NACOS_SPACE} -DNACOS_SERVER_URL=${NACOS_URL}  -Dloader.path=.,lib ${JAR_FILE}"]

#CMD [""]
