Move Solr to /opt and create separate UID/GID

This commit is contained in:
Disassembler 2017-12-13 15:58:29 +01:00
parent 86f9b8cae1
commit cfdbb2c609
3 changed files with 12 additions and 9 deletions

View File

@ -8,6 +8,7 @@ docker build -t solr ${SOURCE_DIR}
# Configure Solr # Configure Solr
mkdir -p /srv/solr/data mkdir -p /srv/solr/data
cp ${SOURCE_DIR}/srv/solr/data/solr.xml /srv/solr/data/solr.xml cp ${SOURCE_DIR}/srv/solr/data/solr.xml /srv/solr/data/solr.xml
chown -R 8983:8983 /srv/solr/data
# Configure Solr service # Configure Solr service
cp ${SOURCE_DIR}/lib/systemd/system/solr.service /lib/systemd/system/solr.service cp ${SOURCE_DIR}/lib/systemd/system/solr.service /lib/systemd/system/solr.service

View File

@ -5,16 +5,18 @@ RUN apk --no-cache add openjdk8-jre-base
RUN apk --no-cache add bash lsof \ 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 \ && 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/ \ && mkdir /opt \
&& mv /srv/solr-6.5.1 /srv/solr \ && tar xzf /tmp/solr-6.5.1.tgz -C /opt/ \
&& mv /opt/solr-6.5.1 /opt/solr \
&& rm -f /tmp/solr-6.5.1.tgz \ && rm -f /tmp/solr-6.5.1.tgz \
&& addgroup -S solr \ && addgroup -S -g 8983 solr \
&& adduser -S -h /srv/solr -H -s /bin/sh -g solr -G solr solr \ && adduser -S -u 8983 -h /var/lib/solr -s /bin/sh -g solr -G solr solr \
&& chown -R solr:solr /srv/solr/ \ && chown -R solr:solr /opt/solr/ \
&& ln -s /srv/solr/bin/solr /usr/local/bin/solr && cp -p /opt/solr/server/solr/solr.xml /var/lib/solr/solr.xml \
&& ln -s /opt/solr/bin/solr /usr/local/bin/solr
VOLUME ["/srv/solr/server/solr"] VOLUME ["/var/lib/solr"]
EXPOSE 8983 EXPOSE 8983
USER solr USER solr
CMD ["solr", "start", "-f"] CMD ["solr", "start", "-f", "-s", "/var/lib/solr"]

View File

@ -4,7 +4,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name solr -v /srv/solr/data:/srv/solr/server/solr solr ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name solr -v /srv/solr/data:/var/lib/solr solr
ExecStop=/usr/bin/docker stop solr ExecStop=/usr/bin/docker stop solr
[Install] [Install]