Skip to content

Commit 00cf030

Browse files
authored
Merge pull request #18 from paulparkinson/main
workshop init 3 - working and will use for doc...
2 parents 6bac439 + ffa9940 commit 00cf030

16 files changed

+164
-106
lines changed

Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
FROM openjdk:11-jre-slim
1+
FROM maven:3.6.3-openjdk-11 AS maven_build
2+
COPY pom.xml /tmp/pom.xml
3+
COPY env.properties /tmp/env.properties
4+
COPY src /tmp/src
5+
COPY lib /tmp/lib
6+
COPY lib/oci-java-sdk-generativeai-3.25.1-preview1-20230906.204234-1.jar /tmp/lib/oci-java-sdk-generativeai-3.25.1-preview1-20230906.204234-1.jar
7+
WORKDIR /tmp/
28

3-
ENTRYPOINT ["java", "-jar", "/usr/share/oracleai/oracleai.jar"]
9+
RUN mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=/tmp/lib/oci-java-sdk-generativeai-3.25.1-preview1-20230906.204234-1.jar
10+
RUN mvn -f /tmp/pom.xml clean package
411

5-
ADD target/oracleai-0.0.1-SNAPSHOT.jar /usr/share/oracleai/oracleai.jar
12+
FROM openjdk
13+
EXPOSE 8080
14+
15+
CMD ls /tmp
16+
COPY --from=maven_build /tmp/target/oracleai-0.0.1-SNAPSHOT.jar /app/oracleai-0.0.1-SNAPSHOT.jar
17+
ENTRYPOINT ["java","-jar","/app/oracleai-0.0.1-SNAPSHOT.jar"]

build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
source env.properties
4-
53
#The following is temporary until release is available in maven and only required to be called once...
64
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=lib/oci-java-sdk-generativeai-3.25.1-preview1-20230906.204234-1.jar
75
mvn clean package

build_and_push.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

build_and_run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
#source ~/Downloads/env.properties
4-
source env.properties
3+
export `cat env.properties`
4+
#export `cat ~/Downloads/env.properties`
55

6-
mvn clean package ; java -Djava.security.debug="access,failure" -jar target/oracleai-0.0.1-SNAPSHOT.jar
6+
mvn clean package ; java -jar target/oracleai-0.0.1-SNAPSHOT.jar

build_docker.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
export IMAGE_NAME=oracleai
4+
export IMAGE_VERSION=0.1
5+
6+
7+
if [ -z "$DOCKER_REGISTRY" ]; then
8+
echo "DOCKER_REGISTRY not set. Will set it to 'test"
9+
export DOCKER_REGISTRY=test
10+
fi
11+
12+
export IMAGE=${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_VERSION}
13+
14+
docker build -t=$IMAGE .
15+
16+
#docker push "$IMAGE"
17+
#if [ $? -eq 0 ]; then
18+
# docker rmi "$IMAGE"
19+
#fi
20+

env.properties

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
#!/bin/bash
2-
3-
## Add exports here... For example...
4-
#export COHERE_KEY="mykeyvalue"
5-
#export OPENAI_KEY="mykeyvalue"
6-
#export OCICONFIG_FILE=~/.oci/config
7-
#export OCICONFIG_PROFILE=DEFAULT
8-
#only set region to override the default found in OCI config, eg if using a feature only avaiable in a certain region
9-
#export REGION="US_CHICAGO_1"
10-
#export COMPARTMENT_ID="ocid1.compartment.oc1..mycompartmentvalue"
11-
#export OBJECTSTORAGE_NAMESPACE="myobjectstorenamespacename"
12-
#export OBJECTSTORAGE_BUCKETNAME="myobjectstorebucketname"
13-
#export ORDS_ENDPOINT_URL="myordsendpointurl"
14-
#export OCI_VISION_SERVICE_ENDPOINT="https://vision.aiservice.myregion.oci.oraclecloud.com"
15-
#export OCI_SPEECH_SERVICE_ENDPOINT="https://speech.aiservice.myregion.oci.oraclecloud.com"
16-
#export OCI_GENAI_SERVICE_ENDPOINT="https://genai.aiservice.us-chicago-1.oci.oraclecloud.com"
17-
18-
## The following are only applicable when using Kubernetes...
19-
#export KUBECONFIG=~/.kube/config-mykubeconfig
20-
#export DOCKER_REGISTRY=us-myregion-1.ocir.io/myocirnamespacename/myocirfolder
21-
1+
OCICONFIG_FILE=~/.oci/config
2+
OCICONFIG_PROFILE=DEFAULT
3+
COMPARTMENT_ID=ocid1.compartment.oc1..mycompartmentvalue
4+
OBJECTSTORAGE_NAMESPACE=myobjectstorenamespacename
5+
OBJECTSTORAGE_BUCKETNAME=myobjectstorebucketname
6+
ORDS_ENDPOINT_URL=https://myordsendpointurl
7+
ORDS_ENDPOINT_URL=https://rddainsuh6u1okc-aidatabaseworkshop.adb.us-ashburn-1.oraclecloudapps.com/ords/aiuser/_sdw/
8+
OCI_VISION_SERVICE_ENDPOINT=https://vision.aiservice.myregion.oci.oraclecloud.com
9+
OCI_SPEECH_SERVICE_ENDPOINT=https://speech.aiservice.myregion.oci.oraclecloud.com
10+
OCI_GENAI_SERVICE_ENDPOINT=https://genai.aiservice.us-chicago-1.oci.oraclecloud.com
11+
OPENAI_KEY=mykeyfordalleifused

pom.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
<spring.boot.version>2.7.6</spring.boot.version>
2121
<spring.vault.version>3.1.1</spring.vault.version>
2222
<oci.sdk.version>3.29.0</oci.sdk.version>
23-
24-
2523
<jib-maven-plugin.version>3.3.1</jib-maven-plugin.version>
2624
<liquibase.version>4.17.2</liquibase.version>
2725
<docker.registry>${env.DOCKER_REGISTRY}</docker.registry>
@@ -176,19 +174,14 @@
176174
</dependencyManagement>
177175
<build>
178176
<plugins>
179-
<plugin>
180-
<groupId>org.springframework.boot</groupId>
181-
<artifactId>spring-boot-maven-plugin</artifactId>
182-
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>9</source><target>9</target></configuration></plugin>
183-
184177
<plugin>
185178
<groupId>org.springframework.boot</groupId>
186179
<artifactId>spring-boot-maven-plugin</artifactId>
187180
</plugin>
188181
<plugin>
189182
<groupId>org.apache.maven.plugins</groupId>
190183
<artifactId>maven-compiler-plugin</artifactId>
191-
<configuration><source>8</source><target>8</target></configuration>
184+
<configuration><source>11</source><target>11</target></configuration>
192185
</plugin>
193186

194187
</plugins>

run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
source env.properties
3+
export `cat env.properties`
44

5-
mvn clean package ; java -jar target/oracleai-0.0.1-SNAPSHOT.jar
5+
java -jar target/oracleai-0.0.1-SNAPSHOT.jar

run_docker.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
export IMAGE_NAME=oracleai
4+
export IMAGE_VERSION=0.1
5+
6+
7+
if [ -z "$DOCKER_REGISTRY" ]; then
8+
echo "DOCKER_REGISTRY not set. Will set it to 'test"
9+
export DOCKER_REGISTRY=test
10+
fi
11+
12+
export IMAGE=${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_VERSION}
13+
14+
docker run --env-file env.properties -p 127.0.0.1:8080:8080/tcp $IMAGE

sql/aiuser-tables-indexes-functions.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
--run as aiuser
2-
31
CREATE TABLE aivision_results
42
(id RAW (16) NOT NULL,
53
date_loaded TIMESTAMP WITH TIME ZONE,
@@ -10,10 +8,12 @@ CREATE TABLE aivision_results
108
/
119

1210
create index aivisionresultsindex on aivision_results(textfromai) indextype is ctxsys.context;
11+
/
12+
1313
--select index_name, index_type, status from user_indexes where index_name = 'AIVISIONAIRESULTSINDEX';
1414
--select idx_name, idx_table, idx_text_name from ctx_user_indexes;
1515
--select token_text from dr$aivisionresultsindex$i;
16-
/
16+
1717

1818
CREATE OR REPLACE FUNCTION VISIONAI_RESULTS_TEXT_SEARCH(p_sql IN VARCHAR2) RETURN SYS_REFCURSOR AS refcursor SYS_REFCURSOR;
1919
BEGIN
@@ -50,10 +50,10 @@ dbms_cloud.create_credential (
5050
);
5151
END;
5252

53-
--The following two functions (text and object detection) are indentical
53+
--The following two functions (text and object detection) are identical
5454
--except for the json_table parsing for the textfromai field,
5555
--and so technically the p_featureType is not necessary and the function could be made to handle/parse both types,
56-
--however, for readability they are broken into two distinct functions
56+
--however, for readability they are broken into two distinct functions.
5757

5858

5959
CREATE OR REPLACE FUNCTION VISIONAI_TEXTDETECTION (

0 commit comments

Comments
 (0)