<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="365583" data-post-id="365583">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="radwo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/radwo/120/32654_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  radwo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hey!</p>
<p>I had recently same issue with extractous. My solution was to copy libtika_native.so and any other lib that is used by extractous to /app/priv/native/ and then point this path in LD_LIBRARY_PATH</p>
<p>I’m doing this like that:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">RUN find /app/_build -name libtika_native.so -exec sh -c 'cp $(dirname {})/*.so /app/priv/native/' \;
ENV LD_LIBRARY_PATH=/app/priv/native
</code></pre>
<p>It’s working for me in dev env and currently I’m trying to make it work with mix release as well.</p>
<hr>
<p>Just tested, and same thing works for mix release, I copied all the needed .so from build layer into the runner and point LD_LIBRARY_PATH to the directory</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">COPY --from=builder --chown=nobody:root /app/native native

ENV LD_LIBRARY_PATH=/app/native:$LD_LIBRARY_PATH
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365583" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/error-failed-to-load-nif-library-in-ci-when-using-rustler-with-dynamic-libraries/69102/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-365583" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365583"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="367100" data-post-id="367100">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="snewcomer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/snewcomer/120/9343_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  snewcomer
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Phoenix Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m starting to come to the realization if you need text for GenAI workflows, getting content out of pdfs/docx is seemless.  In addition to the pdf extraction above with linux <code>pdftotext</code>, docx (doc and txt also) is also easily (perhaps I haven’t touched steel yet) solved.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  defp extract_docx_content(file_path) do
    try do
      file_charlist = String.to_charlist(file_path)

      case :zip.extract(file_charlist, [
             {:file_list, [~c"word/document.xml"]},
             :memory
           ]) do
        {:ok, [{~c"word/document.xml", document_xml}]} -&gt;
          parse_docx_xml(document_xml)

        {:ok, []} -&gt;
          {:error, "No document.xml found in DOCX file"}

        {:error, reason} -&gt;
          {:error, "Failed to read DOCX file: #{inspect(reason)}"}
      end
    rescue
      error in File.Error -&gt;
        {:error, "File error: #{error.reason}"}

      error in ArgumentError -&gt;
        {:error, "Invalid file format or corrupted DOCX: #{Exception.message(error)}"}

      error -&gt;
        {:error, "Unexpected error reading DOCX: #{inspect(error)}"}
    catch
      {:error, reason} -&gt; {:error, reason}
      error -&gt; {:error, "DOCX extraction failed: #{inspect(error)}"}
    end
  end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="367100" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/error-failed-to-load-nif-library-in-ci-when-using-rustler-with-dynamic-libraries/69102/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-367100" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="367100"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>