Skip to content

Commit

Permalink
Add Docker config
Browse files Browse the repository at this point in the history
  • Loading branch information
g-despot committed Feb 4, 2025
1 parent 91a3dcb commit be0151e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use the official OpenJDK image as a base
FROM maven:3.8.4-openjdk-17-slim AS build

# Set the working directory in the container
WORKDIR /app

# Copy the project files into the container
# Adjust paths as needed
COPY ./_includes/code/howto/java/src/test/java/io/weaviate/docs/quickstart/IsReady.java /app/src/test/java/
COPY ./pom.xml /app
RUN ls -alh /app
# Install dependencies and compile the project
RUN mvn clean install
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

// END InstantiationExample
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;

// START InstantiationExample
// Set these environment variables
// WCD_HOSTNAME Your Weaviate instance hostname
// WCD_API_KEY Your Weaviate instance API key

public class IsReady {
public static void main(String[] args) throws Exception {
@Test
public void isReadyTest() throws Exception {
String host = System.getenv("WCD_HOSTNAME");
String apiKey = System.getenv("WCD_API_KEY");

Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
java-app:
build:
context: .
dockerfile: Dockerfile
container_name: java-test-container
working_dir: /app
command: mvn test -Dtest=IsReady
55 changes: 55 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

<!-- Required modelVersion, groupId, artifactId, version -->
<modelVersion>4.0.0</modelVersion>

<groupId>io.weaviate</groupId>
<artifactId>weaviate-java-client</artifactId>
<version>1.0.0</version>

<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<!-- Custom test class pattern -->
<includes>
<include>**/*.java</include> <!-- Matches all classes ending with Test.java -->
<!-- You can add more patterns if needed -->
</includes>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.weaviate</groupId>
<artifactId>client</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>

</project>

0 comments on commit be0151e

Please sign in to comment.