Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Copyright (c) 2024, 2025, Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.

# Ignore everything
**

# Keep the src directory and pyproject.toml file
!src/
!pyproject.toml

# Inside src, ignore specific things
src/**/Dockerfile*
src/**/__pycache__/
src/**/.pytest_cache/
src/**/tns_admin/
src/**/.oci/
src/**/.*
src/**/*.sh
src/**/*.log

# But explicitly keep these
!src/.streamlit
!src/client/spring_ai/templates/env.sh
!src/entrypoint.sh
5 changes: 2 additions & 3 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ jobs:

- name: Build and Push Source
run: |
cd src
zip -r $RUNNER_TEMP/${{ env.SRC }}.zip .
tar -czf "$RUNNER_TEMP/${{ env.SRC }}.tar.gz" .
zip -r $RUNNER_TEMP/${{ env.SRC }}.zip src pyproject.toml .dockerignore
tar -czf "$RUNNER_TEMP/${{ env.SRC }}.tar.gz" src pyproject.toml .dockerignore
gh release upload ${{github.event.release.tag_name}} "$RUNNER_TEMP/${{ env.SRC }}.zip" --clobber
gh release upload ${{github.event.release.tag_name}} "$RUNNER_TEMP/${{ env.SRC }}.tar.gz" --clobber
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ __pycache__/
.pytest_cache
*.py[cod]
*$py.class
*/*.egg-info
**/*.egg-info
**/build/

##############################################################################
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,21 @@ To run the application on bare-metal; download the [source](https://github.com/o
1. Create and activate a Python Virtual Environment:

```bash
cd src/
python3.11 -m venv .venv --copies
source .venv/bin/activate
pip3.11 install --upgrade pip wheel setuptools
pip3.11 install --upgrade pip wheel setuptools uv
```

1. Install the Python modules:

```bash
pip3.11 install -e ".[all]"
source .venv/bin/activate
uv pip install -e ".[all]"
```

1. Start Streamlit:

```bash
cd src/
streamlit run launch_client.py --server.port 8501
```

Expand All @@ -70,11 +69,10 @@ To run the application in a container; download the [source](https://github.com/

1. Build the all-in-one image.

From the `src/` directory, build image:
_Note:_ MacOS Silicon users may need to specify `--arch amd64`

```bash
cd src/
podman build -t ai-optimizer-aio .
podman build -f src/Dockerfile -t ai-optimizer-aio .
```

1. Start the Container:
Expand Down
8 changes: 5 additions & 3 deletions docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ To run the application on bare-metal, download the latest release:
cd ai-optimizer
python3.11 -m venv .venv
source .venv/bin/activate
pip3.11 install --upgrade pip wheel
pip3.11 install --upgrade pip wheel uv
```

1. Install the Python modules:

```bash
pip3.11 install -e ".[all]"
uv pip install -e ".[all]"
```

1. Start Streamlit:
Expand Down Expand Up @@ -108,8 +108,10 @@ To run the application in a container, download the latest release:

1. Build the *ai-optimizer-aio* image.

_Note:_ MacOS Silicon users may need to specify `--arch amd64`

```bash
podman build -t ai-optimizer-aio .
podman build -f src/Dockerfile -t ai-optimizer-aio .
```

1. Start the Container:
Expand Down
7 changes: 4 additions & 3 deletions docs/content/advanced/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ You will need to build the {{< short_app_ref >}} container images and stage them
```

1. Build the {{< short_app_ref >}} images:

_Note:_ Depending on the Kubernetes worker node architecture, you may need to specify `--arch amd64` or `--arch aarm64`

From the code source `src/` directory:
```bash
podman build --arch amd64 -f client/Dockerfile -t ai-optimizer-client:latest .
podman build -f src/client/Dockerfile -t ai-optimizer-client:latest .

podman build --arch amd64 -f server/Dockerfile -t ai-optimizer-server:latest .
podman build -f src/server/Dockerfile -t ai-optimizer-server:latest .
```

1. Tag the {{< short_app_ref >}} images:
Expand Down
4 changes: 3 additions & 1 deletion docs/content/walkthrough/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ The {{< short_app_ref >}} provides an easy to use front-end for experimenting wi

1. Build the Container Image

_Note:_ MacOS Silicon users may need to specify `--arch amd64`

```bash
cd ai-optimizer
podman build --arch amd64 -t localhost/ai-optimizer-aio:latest .
podman build -f src/Dockerfile -t localhost/ai-optimizer-aio:latest .
```

1. Start the {{< short_app_ref >}}:
Expand Down
4 changes: 2 additions & 2 deletions opentofu/modules/kubernetes/templates/k8s_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spec:
- --local
- context=/workspace
- --local
- dockerfile=/workspace/server
- dockerfile=/workspace/src/server
- --output
- type=image,name=${repository_server}:latest,push=true
securityContext:
Expand Down Expand Up @@ -172,7 +172,7 @@ spec:
- --local
- context=/workspace
- --local
- dockerfile=/workspace/client
- dockerfile=/workspace/src/client
- --output
- type=image,name=${repository_client}:latest,push=true
securityContext:
Expand Down
8 changes: 4 additions & 4 deletions opentofu/modules/vm/templates/cloudinit-compute.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ write_files:
cd /app
python3.11 -m venv .venv
source .venv/bin/activate
pip3.11 install --upgrade pip wheel setuptools
pip3.11 install torch==2.8.0+cpu -f https://download.pytorch.org/whl/cpu/torch
pip3.11 install -e ".[all]" --quiet --no-input &
pip3.11 install --upgrade pip wheel setuptools uv
uv pip install torch==2.8.0+cpu -f https://download.pytorch.org/whl/cpu/torch
uv pip install -e ".[all]" &
INSTALL_PID=$!

# Install Models
Expand Down Expand Up @@ -101,7 +101,7 @@ write_files:
find /app -name "*.nbc" -delete
# Set venv and start
source /app/.venv/bin/activate
streamlit run /app/launch_client.py --server.port 8501 --server.address 0.0.0.0
streamlit run /app/src/launch_client.py --server.port 8501 --server.address 0.0.0.0

runcmd:
- /tmp/root_setup.sh
Expand Down
43 changes: 21 additions & 22 deletions src/pyproject.toml → pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors = [

# Common dependencies that are always needed
dependencies = [
"langchain-core==0.3.75",
"langchain-core==0.3.76",
"httpx==0.28.1",
"oracledb~=3.1",
"plotly==6.3.0",
Expand All @@ -26,36 +26,35 @@ server = [
"bokeh==3.8.0",
"evaluate==0.4.5",
"faiss-cpu==1.12.0",
"fastapi==0.116.1",
"fastmcp==2.12.0",
"fastapi==0.117.1",
"fastmcp==2.12.3",
"giskard==2.18.0",
"langchain-anthropic==0.3.19",
"langchain-azure-ai==0.1.5",
"langchain-aws==0.2.31",
"langchain-cohere==0.4.5",
"langchain-anthropic==0.3.20",
"langchain-aws==0.2.33",
"langchain-cohere==0.4.6",
"langchain-community==0.3.29",
"langchain-deepseek==0.1.4",
"langchain-google-genai==2.1.10",
"langchain-google-vertexai==2.0.28",
"langchain-groq==0.3.7",
"langchain-google-genai==2.1.12",
"langchain-google-vertexai==2.1.2",
"langchain-groq==0.3.8",
"langchain-huggingface==0.3.1",
"langchain-mistralai==0.2.11",
"langchain-mcp-adapters==0.1.9",
"langchain-ollama==0.3.7",
"langchain-openai==0.3.32",
"langchain-mistralai==0.2.12",
"langchain-mcp-adapters==0.1.10",
"langchain-ollama==0.3.8",
"langchain-openai==0.3.33",
"langchain-perplexity==0.1.2",
"langchain-xai==0.2.5",
"langgraph==0.6.6",
"litellm==1.77.1",
"llama-index==0.13.3",
"lxml==6.0.0",
"langgraph==0.6.7",
"litellm==1.77.3",
"llama-index==0.14.2",
"lxml==6.0.2",
"matplotlib==3.10.6",
"oci~=2.0",
"psutil==7.0.0",
"psutil==7.1.0",
"python-multipart==0.0.20",
"torch==2.8.0",
"umap-learn==0.5.9.post2",
"uvicorn==0.35.0",
"uvicorn==0.36.0",
]

# GUI component dependencies
Expand Down Expand Up @@ -85,8 +84,8 @@ all-test = [
]

[tool.setuptools]
packages = ["server", "client", "common"]
packages = ["src.server", "src.client", "src.common"]

[tool.setuptools_scm]
root = ".."
root = "."
fallback_version = "0.0.0"
12 changes: 0 additions & 12 deletions src/.dockerignore

This file was deleted.

47 changes: 23 additions & 24 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
## Copyright (c) 2024, 2025, Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
# spell-checker:disable
##################################################
# Base - All-In-One
##################################################
FROM container-registry.oracle.com/os/oraclelinux:8-slim AS all_in_one_pyenv
ENV RUNUSER=oracleai \
VIRTUAL_ENV=/opt/.venv

# NUMBA_DISABLE_JIT is for Apple Silicon support
ENV TOKENIZERS_PARALLELISM=true \
NUMBA_DISABLE_JIT=1 \
RUNUSER=oracleai

RUN microdnf --nodocs -y update && \
microdnf --nodocs -y install python3.11 python3.11-pip && \
RUN groupadd $RUNUSER && \
useradd -u 10001 -g $RUNUSER -md /app $RUNUSER && \
microdnf --nodocs -y install python3.11 python3.11-pip python3.11-devel gcc gcc-c++ && \
microdnf clean all && \
python3.11 -m venv --symlinks --upgrade-deps /opt/.venv && \
groupadd $RUNUSER && \
useradd -u 10001 -g $RUNUSER -md /app $RUNUSER
RUN for dir in server client common; do \
install -d -m 0700 -o $RUNUSER -g $RUNUSER /opt/package/$dir; \
done
python3.11 -m venv --symlinks --upgrade-deps $VIRTUAL_ENV

# Copy only pyproject.toml for dependency installation
COPY --chown=$RUNUSER:$RUNUSER src /opt/package/src
COPY pyproject.toml /opt/package/pyproject.toml
# Use the virtual environment for pip installations
RUN /opt/.venv/bin/pip install --upgrade pip wheel setuptools && \
/opt/.venv/bin/pip install torch==2.8.0+cpu -f https://download.pytorch.org/whl/cpu/torch && \
/opt/.venv/bin/pip install --no-cache-dir "/opt/package[all]"

RUN ${VIRTUAL_ENV}/bin/pip install --upgrade pip wheel setuptools uv && \
${VIRTUAL_ENV}/bin/uv pip install torch==2.8.0+cpu -f https://download.pytorch.org/whl/cpu/torch && \
${VIRTUAL_ENV}/bin/uv pip install "/opt/package[all]"

##################################################
# Application
##################################################
FROM all_in_one_pyenv AS oai_application
ENV PATH=/opt/.venv/bin:$PATH
ENV TEMP=/app/tmp
ENV TNS_ADMIN=/app/tns_admin
ENV API_SERVER_CONTROL="TRUE"
ENV OCI_CLI_CONFIG_FILE=/app/runtime/.oci/config
ENV PATH=$VIRTUAL_ENV/bin:$PATH \
TEMP=/app/tmp \
TNS_ADMIN=/app/tns_admin \
OCI_CLI_CONFIG_FILE=/app/runtime/.oci/config \
TOKENIZERS_PARALLELISM=true \
NUMBA_CACHE_DIR=/app/tmp \
MPLCONFIGDIR=/app/tmp \
TIKTOKEN_CACHE_DIR=/app/tmp \
NLTK_DATA=/app/tmp \
API_SERVER_CONTROL="TRUE"

# Expect the .oci directory to be mounted to /app/.oci
VOLUME ["/app/.oci"]
Expand All @@ -46,7 +45,7 @@ VOLUME ["/app/tns_admin"]
RUN for dir in $TEMP $TNS_ADMIN $(dirname $OCI_CLI_CONFIG_FILE); do \
install -d -m 0700 -o $RUNUSER -g $RUNUSER $dir; \
done
COPY --chown=$RUNUSER:$RUNUSER . /app/
COPY --chown=$RUNUSER:$RUNUSER src /app/

# Set user and working directory
USER $RUNUSER
Expand Down
30 changes: 14 additions & 16 deletions src/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
## Copyright (c) 2024, 2025, Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
# spell-checker: disable
#############################################################
# Base - Web GUI
# Build from the src/ directory:
# podman build -f client/Dockerfile -t ai-optimizer-client:latest .
# Build from the / directory:
# podman build -f src/client/Dockerfile -t ai-optimizer-client:latest .
#############################################################
# spell-checker: disable
FROM container-registry.oracle.com/os/oraclelinux:8-slim AS optimizer_base
ENV RUNUSER=oracleai \
VIRTUAL_ENV=/opt/.venv

ENV RUNUSER=oracleai
ENV PATH=/opt/.venv/bin:$PATH

RUN microdnf --nodocs -y update && \
microdnf --nodocs -y install python3.11 python3.11-pip && \
RUN groupadd $RUNUSER && \
useradd -u 10001 -g $RUNUSER -md /app $RUNUSER && \
microdnf --nodocs -y install python3.11 python3.11-pip python3.11-devel gcc gcc-c++ && \
microdnf clean all && \
python3.11 -m venv --symlinks --upgrade-deps /opt/.venv && \
groupadd $RUNUSER && \
useradd -u 10001 -g $RUNUSER -md /app $RUNUSER
RUN for dir in server client common; do \
install -d -m 0700 -o $RUNUSER -g $RUNUSER /opt/package/$dir; \
done
python3.11 -m venv --symlinks --upgrade-deps $VIRTUAL_ENV

COPY --chown=$RUNUSER:$RUNUSER src /opt/package/src
COPY pyproject.toml /opt/package/pyproject.toml

RUN /opt/.venv/bin/pip install --no-cache-dir "/opt/package[client]"
RUN ${VIRTUAL_ENV}/bin/pip install --upgrade pip wheel setuptools uv && \
${VIRTUAL_ENV}/bin/uv pip install "/opt/package[client]"

##################################################
# Clint Application
Expand All @@ -36,7 +33,8 @@ ENV TEMP=/app/tmp
RUN for dir in $TEMP; do \
install -d -m 0700 -o $RUNUSER -g $RUNUSER $dir; \
done
COPY --chown=$RUNUSER:$RUNUSER . /app/

COPY --chown=$RUNUSER:$RUNUSER src /app/
RUN rm -rf /app/server /app/launch_server.py

# Set user and working directory
Expand Down
Loading
Loading