Skip to content
Closed
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
17 changes: 17 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#Import java base image (using maven to build project)
FROM maven:3.6.1-jdk-11-slim

#Create new maven project
RUN mvn -B archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=app \
-DartifactId=java-sdk-docker-app

#Change to maven project directory
WORKDIR /java-sdk-docker-app

#Copy pom.xml file into project to set build dependencies.
COPY pom.xml .

#Builds maven project, installing the sdk.
RUN mvn compile
25 changes: 25 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Docker
You can use docker to 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. Download the dockerfile for this SDK and edit as needed.
- Change the maven version as needed `FROM maven:<your-version>` ( this java project is built using maven )
- For valid maven java images on docker see <https://hub.docker.com/_/maven>

- Copy code/project that you wish to test into the dockerfile
- Add line `COPY <src>... <dest>`
- App Path: `/src/main/java/java-sdk-docker-app`
- Test Path: `/src/test/java/java-sdk-docker-app`

- Set dockerfile to execute code
- Add line `CMD [ "<executable>" ]`

- For more information on dockerfile construction please visit <https://docs.docker.com/engine/reference/builder/>

3. Build and run the docker image.
- Navigate to docker file directory
- To build the docker image run `docker build --tag=<your-tag> .`
- To run the docker image run `docker run <your-tag>`
27 changes: 27 additions & 0 deletions docker/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<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>app</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.0</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>7</maven.compiler.source>
<maven.compiler.target>7</maven.compiler.target>
</properties>
</project>