<p>Is there a way to install/download the library <code>jts-core</code> in the folder <code>SOLR_INSTALL/server/solr-webapp/webapp/WEB-INF/lib/</code>? As specified in the official guide: <a href="https://solr.apache.org/guide/8_10/spatial-search.html#jts-and-polygons-flat" rel="nofollow noreferrer">https://solr.apache.org/guide/8_10/spatial-search.html#jts-and-polygons-flat</a></p>
<p>Actually, I tried to put in the middle an <code>initContainer</code> that downloads such jar, but I get obviously a <code>Permission denied</code> from the Solr container since only root can write on the final solr container.</p>
<p>I tried also to set a <code>securityContext</code> only for my <code>initContainer</code>, in order to run as root, but that configuration has no effect in the <code>initContainer</code>, I think it is not seen by the Solr CRD.</p>
<pre><code>podOptions:
  initContainers:
  - name: &quot;install-jts-core&quot;
    image: solr:8.9.0
    command: ['sh', '-c', 'wget -O /opt/solr-8.9.0/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.15.1.jar https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar']
    securityContext:   &lt;--- this has no effect on SolrCloud CRD
      runAsUser: 0
</code></pre>
<p>Another disperate attempt was to set a <code>podSecurityContext.runAsUser: 0</code>, so for all containers in the pod, but Solr does not run as <code>root</code>, I discarded that option by the way.</p>
<p>Any hint/idea/solution please?</p>
<p>Thank you very much in advance.</p>

Fernando Aspiazu
<p>I have recently found a solution that may not be elegant, but works well in any version of Solr image, below a configuration example:</p>
<pre class="lang-yaml prettyprint-override"><code>podOptions:
  initContainers:
  - name: &quot;install-jts-lib&quot;
    image: solr:8.9.0
    command:
    - 'sh'
    - '-c'
    - |
      wget -O /tmp-webinf-lib/jts-core-1.15.1.jar https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar
      cp -R /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/* /tmp-webinf-lib
    volumeMounts:
    - mountPath: /tmp-webinf-lib
      name: web-inf-lib
  volumes:
  - name: web-inf-lib
    source:
      emptyDir: {}
    defaultContainerMount:
      name: web-inf-lib
      mountPath: /opt/solr/server/solr-webapp/webapp/WEB-INF/lib
</code></pre>
<p>In this example, I create an <code>emptyDir</code> volume and attach it in any directory of the <code>initContainer</code>, but in the final Solr container I attach it in the <code>target directory ($SOLR_HOME/server/solr-webapp/webapp/WEB-INF/lib)</code>.</p>
<p>This will empty the <code>../WEB-INF/lib</code> directory, but since I'm using <strong>the same Solr image</strong>, I can copy the content of <code>../WEB-INF/lib</code> (jars and folders) of the <code>initContainer</code> at the end.</p>
<p>The effect is that the final container will have all the content it should have had plus the <code>jts-core-1.15.1.jar</code> jar.</p>
<p>This works also with other files or libraries you want to bring in the Solr container.</p>
<p>Let me know what do you think of this workaround 👍</p>
<p>Thank you.</p>
