This is an automated email from the ASF dual-hosted git repository.

ndipiazza pushed a commit to branch TIKA-4578
in repository https://gitbox.apache.org/repos/asf/tika.git

commit ffb8a42c120fa7d72c2795ccf92fbdf8fb08d302
Author: Nicholas DiPiazza <[email protected]>
AuthorDate: Tue Dec 16 13:52:38 2025 -0600

    TIKA-4578: Integrate Docker build into Maven lifecycle
    
    - Add two exec-maven-plugin configurations matching reference pattern
    - First plugin: runs TikaGrpcServer (exec:java)
    - Second plugin: chmod and docker-build.sh executions
    - Add validate phase execution to chmod +x the docker-build.sh script
    - Add package phase execution to run prepare-docker-image
    - Add skip.docker.build property (default: true) to control execution
    - Update README with Maven integration instructions
---
 tika-grpc/docker-build/README.md | 29 +++++++++++++++++++++++------
 tika-grpc/pom.xml                | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/tika-grpc/docker-build/README.md b/tika-grpc/docker-build/README.md
index 7bf2ad5ee..3278ac95e 100644
--- a/tika-grpc/docker-build/README.md
+++ b/tika-grpc/docker-build/README.md
@@ -16,21 +16,33 @@ The Docker image includes:
 
 ### Prerequisites
 
-1. Build Tika from the project root:
+1. Build Tika from the project root (this builds all modules including 
plugins):
 ```bash
 mvn clean install -DskipTests
 ```
 
-2. Set the required environment variable:
+### Option 1: Run Docker Build During Maven Package
+
+The Docker build can be triggered automatically during the Maven package phase:
+
 ```bash
-export TIKA_VERSION=4.0.0-SNAPSHOT
+cd tika-grpc
+mvn package -Dskip.docker.build=false
+```
+
+Or from the project root:
+```bash
+mvn clean install -DskipTests -Dskip.docker.build=false
 ```
 
-### Run the Docker Build Script
+**Note:** By default, `skip.docker.build=true` to avoid running Docker builds 
during normal development.
 
-From the project root directory:
+### Option 2: Run the Docker Build Script Manually
+
+Set the required environment variable and run the script:
 
 ```bash
+export TIKA_VERSION=4.0.0-SNAPSHOT
 ./tika-grpc/docker-build/docker-build.sh
 ```
 
@@ -47,7 +59,12 @@ From the project root directory:
 
 ### Examples
 
-Build and tag for Docker Hub:
+Build with Maven (recommended for CI/CD):
+```bash
+mvn clean install -DskipTests -Dskip.docker.build=false -DdockerId=myusername
+```
+
+Build and tag for Docker Hub (manual script):
 ```bash
 export TIKA_VERSION=4.0.0-SNAPSHOT
 export DOCKER_ID=myusername
diff --git a/tika-grpc/pom.xml b/tika-grpc/pom.xml
index 5a5094a9f..bdffe7453 100644
--- a/tika-grpc/pom.xml
+++ b/tika-grpc/pom.xml
@@ -38,6 +38,7 @@
     <asarkar-grpc-test.version>2.0.0</asarkar-grpc-test.version>
     <awaitility.version>4.3.0</awaitility.version>
     <j2objc-annotations.version>3.1</j2objc-annotations.version>
+    <skip.docker.build>true</skip.docker.build>
   </properties>
 
   <dependencyManagement>
@@ -387,6 +388,45 @@
           <mainClass>org.apache.tika.pipes.grpc.TikaGrpcServer</mainClass>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>${maven.exec.version}</version>
+        <executions>
+          <execution>
+            <id>set-chmod-on-docker-build-sh</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>chmod</executable>
+              <arguments>
+                <argument>+x</argument>
+                
<argument>${project.basedir}/docker-build/docker-build.sh</argument>
+              </arguments>
+              <skip>${skip.docker.build}</skip>
+            </configuration>
+          </execution>
+          <execution>
+            <id>prepare-docker-image</id>
+            <phase>package</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>bash</executable>
+              <arguments>
+                
<argument>${project.basedir}/docker-build/docker-build.sh</argument>
+              </arguments>
+              <environmentVariables>
+                <TIKA_VERSION>${project.version}</TIKA_VERSION>
+              </environmentVariables>
+              <skip>${skip.docker.build}</skip>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <artifactId>maven-shade-plugin</artifactId>
         <version>${maven.shade.version}</version>

Reply via email to