FROM java:8-jre

ENV LS_VERSION 5

ENV URL https://staging.elastic.co/5.0.0-beta1-5eb5cbdb/downloads/logstash/logstash-5.0.0-beta1.tar.gz
ENV VERSION 5.0.0-beta1
ENV PATH $PATH:/opt/logstash-$VERSION/bin

# As all snapshot builds have the same url, the image is cached. The date at then can be used to invalidate the image
RUN set -x && \
    cd /opt && \
    wget -q $URL && \
    tar xzf logstash-$VERSION.tar.gz


COPY logstash.conf.2.tmpl /logstash.conf.2.tmpl
COPY docker-entrypoint.sh /entrypoint.sh

COPY pki /etc/pki

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 5044 5055

CMD logstash -f /logstash.conf --log.level=debug --config.debug
