IMAGE solr6_6.5.1-201021
FROM alpine3.12-java8_8.252.09-201021

RUN EOF
    # Install runtime dependencies
    apk --no-cache add bash lsof

    # Download and install Solr
    wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O - | tar xzf - -C /opt
    mv /opt/solr-6.5.1 /opt/solr

    # Create OS user
    addgroup -S -g 8983 solr
    adduser -S -u 8983 -h /var/lib/solr -s /bin/false -g solr -G solr solr
    chown -R solr:solr /opt/solr

    # Make start/stop script visible globally (also defines directory for solr.in.sh)
    ln -s /opt/solr/bin/solr /usr/bin/solr
EOF

COPY image.d

USER solr
CMD /usr/bin/solr start -f
READY /bin/grep -q "o.e.j.s.Server Started" /opt/solr/server/logs/solr.log