-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
68 lines (56 loc) · 2.52 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM openjdk:8-jre
MAINTAINER Martijn Koster "mak-docker@greenhills.co.uk"
# Override the solr download location with e.g.:
# docker build -t mine --build-arg SOLR_DOWNLOAD_SERVER=http://www-eu.apache.org/dist/lucene/solr .
ARG SOLR_DOWNLOAD_SERVER
RUN apt-get update && \
apt-get -y install lsof && \
rm -rf /var/lib/apt/lists/*
ENV SOLR_USER solr
ENV SOLR_UID 8983
RUN groupadd -r -g $SOLR_UID $SOLR_USER && \
useradd -r -u $SOLR_UID -g $SOLR_USER $SOLR_USER
ENV SOLR_VERSION 6.5.1
ENV SOLR_URL ${SOLR_DOWNLOAD_SERVER:-https://archive.apache.org/dist/lucene/solr}/$SOLR_VERSION/solr-$SOLR_VERSION.tgz
ENV SOLR_SHA256 7c6a7d4474d5e847a8ddd0a4717d33bf5db07adf17c3d36ad1532c72885bd5d3
ENV SOLR_KEYS 052C5B48A480B9CEA9E218A5F98C13CFA5A135D8
RUN set -e; for key in $SOLR_KEYS; do \
found=''; \
for server in \
ha.pool.sks-keyservers.net \
hkp://keyserver.ubuntu.com:80 \
hkp://p80.pool.sks-keyservers.net:80 \
pgp.mit.edu \
; do \
echo " trying $server for $key"; \
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$key" && found=yes && break; \
done; \
test -z "$found" && echo >&2 "error: failed to fetch $key from several disparate servers -- network issues?" && exit 1; \
done; \
exit 0
RUN mkdir -p /opt/solr && \
wget -nv $SOLR_URL -O /opt/solr.tgz && \
wget -nv $SOLR_URL.asc -O /opt/solr.tgz.asc && \
echo "$SOLR_SHA256 */opt/solr.tgz" | sha256sum -c - && \
(>&2 ls -l /opt/solr.tgz /opt/solr.tgz.asc) && \
gpg --batch --verify /opt/solr.tgz.asc /opt/solr.tgz && \
tar -C /opt/solr --extract --file /opt/solr.tgz --strip-components=1 && \
rm /opt/solr.tgz* && \
rm -Rf /opt/solr/docs/ && \
mkdir -p /opt/solr/server/solr/lib /opt/solr/server/solr/mycores && \
sed -i -e 's/#SOLR_PORT=8983/SOLR_PORT=8983/' /opt/solr/bin/solr.in.sh && \
sed -i -e '/-Dsolr.clustering.enabled=true/ a SOLR_OPTS="$SOLR_OPTS -Dsun.net.inetaddr.ttl=60 -Dsun.net.inetaddr.negative.ttl=60"' /opt/solr/bin/solr.in.sh && \
chown -R $SOLR_USER:$SOLR_USER /opt/solr && \
mkdir /docker-entrypoint-initdb.d /opt/docker-solr/
COPY scripts /opt/docker-solr/scripts
RUN chmod +x /opt/docker-solr/scripts/*
RUN chown -R $SOLR_USER:$SOLR_USER /opt/docker-solr
ENV PATH /opt/solr/bin:/opt/docker-solr/scripts:$PATH
EXPOSE 8983
WORKDIR /opt/solr
USER $SOLR_USER
#添加IK分词器
COPY ik/ik-analyzer-solr5-5.x.jar /opt/solr/server/solr-webapp/webapp/WEB-INF/lib
COPY ik/classes /opt/solr/server/solr-webapp/webapp/WEB-INF/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["solr-foreground"]