From 3e123a9a9cd33b9fe02a55b560c8e2478de802fd Mon Sep 17 00:00:00 2001 From: Disassembler Date: Wed, 13 Dec 2017 10:18:38 +0100 Subject: [PATCH] Add Dockerfile for Solr --- solr.sh | 9 +++++++++ solr/Dockerfile | 20 ++++++++++++++++++++ solr/lib/systemd/system/solr.service | 11 +++++++++++ 3 files changed, 40 insertions(+) create mode 100755 solr.sh create mode 100644 solr/Dockerfile create mode 100644 solr/lib/systemd/system/solr.service diff --git a/solr.sh b/solr.sh new file mode 100755 index 0000000..064e295 --- /dev/null +++ b/solr.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +SOURCE_DIR=$(realpath $(dirname "${0}"))/solr + +# Prepare Docker mount structure +mkdir -p /srv/solr/server/solr + +# Build Docker container +docker build -t solr ${SOURCE_DIR} diff --git a/solr/Dockerfile b/solr/Dockerfile new file mode 100644 index 0000000..a419902 --- /dev/null +++ b/solr/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.7 +MAINTAINER Disassembler + +RUN apk --no-cache add openjdk8-jre-base + +RUN apk --no-cache add bash lsof \ + && wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O /tmp/solr-6.5.1.tgz \ + && tar xzf /tmp/solr-6.5.1.tgz -C /srv/ \ + && mv /srv/solr-6.5.1 /srv/solr \ + && rm -f /tmp/solr-6.5.1.tgz \ + && addgroup -S solr \ + && adduser -S -h /srv/solr/data -s /bin/sh -g solr -G solr solr \ + && chown -R solr:solr /srv/solr/ \ + && ln -s /srv/solr/bin/solr /usr/local/bin/solr + +VOLUME ["/srv/solr/server/solr"] +EXPOSE 8983 + +USER solr +CMD ["solr", "start", "-f"] diff --git a/solr/lib/systemd/system/solr.service b/solr/lib/systemd/system/solr.service new file mode 100644 index 0000000..6fff07f --- /dev/null +++ b/solr/lib/systemd/system/solr.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenMapKit Solr container +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name solr -v /srv/solr/server/solr:/srv/solr/server/solr solr +ExecStop=/usr/bin/docker stop solr + +[Install] +WantedBy=multi-user.target