Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ message = Update version numbers from {current_version} -> {new_version}
[bumpversion:file:tone-analyzer/README.md]

[bumpversion:file:visual-recognition/README.md]

[bumpversion:file:docker/pom.xml]
search = {current_version}
replace = {new_version}

13 changes: 13 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Import java base image (using maven to build project)
FROM maven:3.6.1-jdk-11-slim

# Copy project files
COPY pom.xml /app/pom.xml
COPY src /app/src
WORKDIR /app

# Build project
RUN mvn compiler:compile -f "/app/pom.xml"

# Be sure to change the main class name if you use your own files!
RUN mvn -e exec:java -Dexec.mainClass="com.ibm.DockerTest"
19 changes: 19 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Using this library in Docker
You can use the provided Dockerfile and POM to help test issues you have with the SDK.

1. Install Docker
- Mac: <https://docs.docker.com/docker-for-mac/install/>
- Windows: <https://docs.docker.com/docker-for-windows/install/>
2. Add the dependencies and code you'd like to test
- If you're testing a simple project, you can edit the `DockerTest.java` file directly. Everything's set up to pull in the lastest version of the `ibm-watson` package and run that file when building the image.
- If you'd like to use your own files, feel free to add them. Just be sure to edit the execution line in the Dockerfile to run your main class:

```
RUN mvn -e exec:java -Dexec.mainClass="com.ibm.<MAIN_CLASS>"
```
If you import a project with a different group ID, you'll need to change that in the provided `pom.xml` as well.

- For more information on dockerfile construction please visit <https://docs.docker.com/engine/reference/builder/>
3. Build the Docker image
- From the directory with the Dockerfile, run `docker build --tag=<your-tag> .`
- You should be able to verify that everything worked properly based on the output!
43 changes: 43 additions & 0 deletions docker/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm</groupId>
<artifactId>java-sdk-docker-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-sdk-docker-app</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.watson</groupId>
<artifactId>ibm-watson</artifactId>
<version>7.3.1</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>7</maven.compiler.source>
<maven.compiler.target>7</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
7 changes: 7 additions & 0 deletions docker/src/main/java/com/ibm/DockerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ibm;

public class DockerTest {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
Loading