FROM openjdk:8-alpine

MAINTAINER EstiNet

ARG PORT_NUM
ENV PORT_NUM ${PORT_NUM:-10200}

ARG EC_PORT_NUM
ENV EC_PORT_NUM ${EC_PORT_NUM:-9200}

ARG EC_NAME
ENV EC_NAME ${EC_NAME:-FusionPlay1}

ARG CS_NAME
ENV CS_NAME ${CS_NAME:-FusionPlay1}

EXPOSE $EC_PORT_NUM $PORT_NUM

COPY . /usr/src/server
WORKDIR /usr/src/server

RUN echo server-port=$PORT_NUM >> server.properties
RUN echo port=$EC_PORT_NUM >> esticonsole.properties
RUN echo "    Name: $CS_NAME" >> plugins/gFeatures/Config.yml
RUN echo server_name=$EC_NAME >> esticonsole.properties

# RUN apk add --no-cache screen

RUN mkdir /data
RUN mkdir /data/logs
RUN mkdir /data/plugins

# CMD screen -S -X 'java -jar EstiConsole.jar\n'
CMD exec java -jar EstiConsole.jar