Skip to content

Commit

Permalink
Merge pull request #4 from aborroy/feature/MavenDockerBuild
Browse files Browse the repository at this point in the history
Support building image from maven build.
  • Loading branch information
aborroy authored Sep 21, 2021
2 parents 7788ead + 2159f83 commit 9847882
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
6 changes: 5 additions & 1 deletion ats-transformer-ocr/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM jbarlow83/ocrmypdf
FROM ubuntu:latest

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y ocrmypdf

# Install OpenJDK 11
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
Expand Down
22 changes: 22 additions & 0 deletions ats-transformer-ocr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<properties>
<alfresco.transformer.base.version>2.5.4-SNAPSHOT</alfresco.transformer.base.version>
<image.tag>latest</image.tag>
</properties>

<dependencies>
Expand Down Expand Up @@ -43,6 +44,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.34.1</version>
<configuration>
<images>
<image>
<name>alfresco/tengine-ocr:${image.tag}</name>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class PdfToOcrdPdfTransformerExecutor implements JavaExecutor
public String getTransformerId() {
return "ocr";
}

@Override
public void call(File sourceFile, File targetFile, String... args) throws TransformException
{
Expand All @@ -50,12 +50,12 @@ public void call(File sourceFile, File targetFile, String... args) throws Transf
{

Process process = Runtime.getRuntime().exec(
String.format("/usr/local/bin/ocrmypdf " + sourceFile.getPath() + " " + targetFile.getPath()));
String.format("/usr/bin/ocrmypdf " + sourceFile.getPath() + " " + targetFile.getPath()));
StreamGobbler streamGobbler = new StreamGobbler(process.getInputStream(), System.out::println);
Executors.newSingleThreadExecutor().submit(streamGobbler);
process.waitFor();

}
}
catch (Exception e)
{
throw new TransformException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
Expand Down

0 comments on commit 9847882

Please sign in to comment.