FROM azul/zulu-openjdk:11.0.22-jdk
VOLUME /tmp
RUN useradd -b /home -m -s /bin/bash clay
RUN chmod a+xr -R /home/clay && chown clay:clay -R /home/clay
#COPY skywalking /home/clay/skywalking-agent
#RUN chmod a+xr -R /home/clay/skywalking-agent && chown clay:clay -R /home/clay/skywalking-agent
USER clay
ARG NAME=$DRONE_COMMIT_BRANCH
COPY ./$NAME.jar /home/clay/$NAME.jar
COPY start.sh /home/clay/start.sh
WORKDIR /home/clay
RUN mkdir -p /home/clay/logs && touch /home/clay/logs/spring.log
#RUN mkdir -p /home/clay/code
#RUN chmod 777 /home/clay/code
#RUN mkdir -p /home/clay/skywalking-agent/logs && touch /home/clay/skywalking-agent/logs/skywalking-api.log
ENV REF_NAME dev
EXPOSE 8080
CMD bash /home/clay/start.sh $REF_NAME && echo "start logging..." && : > /home/clay/logs/spring.log && tail -F -n 500 /home/clay/logs/spring.log