Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
74 changes: 50 additions & 24 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,66 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm as kind
FROM mcr.microsoft.com/devcontainers/base:ubuntu

# Change to root only when running locally on MAC, otherwise leave it to vscode
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG HELM_VERSION=v3.17.0
# Multiarchitecture, plattform is passed on when building the image.
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH

RUN export DEBIAN_FRONTEND=noninteractive
RUN echo "Host is running on $BUILDPLATFORM and the binaries will be downloaded for '$TARGETARCH', building for $TARGETPLATFORM"

COPY docker.sh /tmp/scripts/
RUN chmod +x /tmp/scripts/docker.sh
# Install Docker CLI (not daemon)
RUN apt update && apt install -y \
docker.io \
curl \
ca-certificates \
iptables \
socat \
ebtables \
ethtool \
conntrack \
sudo \
gh \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

# update the container
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install zsh ca-certificates gnupg jq -y && \
apt-get autoremove -y && \
apt-get clean -y

# Install kubectl
RUN curl -sSL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \
&& chmod +x /usr/local/bin/kubectl
# Install kubectl (x86_64/amd64, aarch64/arm64)
RUN curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/$TARGETARCH/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
&& rm kubectl

# Install Helm
RUN curl -s https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash -
RUN curl -LO https://get.helm.sh/helm-$HELM_VERSION-linux-$TARGETARCH.tar.gz \
&& tar -zxvf helm-$HELM_VERSION-linux-$TARGETARCH.tar.gz \
&& mv linux-$TARGETARCH/helm /usr/local/bin/helm \
&& chmod +x /usr/local/bin/helm \
&& rm -rf helm-$HELM_VERSION-linux-$TARGETARCH.tar.gz linux-$TARGETARCH

# Install kind
RUN KIND_RELEASE=$(curl --silent "https://api.github.com/repos/kubernetes-sigs/kind/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') \
&& curl -sSL -o /usr/local/bin/kind https://kind.sigs.k8s.io/dl/$KIND_RELEASE/kind-linux-amd64 \
&& curl -sSL -o /usr/local/bin/kind https://kind.sigs.k8s.io/dl/$KIND_RELEASE/kind-linux-$TARGETARCH \
&& chmod +x /usr/local/bin/kind

# Install Node.js and npm (multi-architecture support)
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest \
&& rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /

RUN chmod +x /entrypoint.sh

RUN /tmp/scripts/docker.sh
# In case the user is root, easy workaround when running locally on MAC so root can access the docker.socket of the hosts, otherwise user should be vscode.
# Change ownership carefully and use only locally. Container should run with --privileged
RUN if [ "$USERNAME" != "root" ]; then \
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
fi

# change ownership of the home directory
RUN chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
USER $USERNAME

WORKDIR /home/${USERNAME}
USER ${USERNAME}
# Entrypoint is on the mounted volume using the framework, post-create.sh
ENTRYPOINT ["/entrypoint.sh"]

ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ]
37 changes: 37 additions & 0 deletions .devcontainer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Make file for building the image, cleaning, pushing and running locally and remote.

# If the image does not exits, it will build it first, then run it.
# If the image exists but is not started it will create a new container.
# If the container is stopped then it will start it again.
# if the container is running it will attach a new shell to it.
start:
@bash -c ' \
source ./makefile.sh; \
start \
echo "Done"; '

# Target for building the image
build-nocache:
@bash -c ' \
source ./makefile.sh; \
buildNoCache; \
echo "Done"; '

# Target for building the image
build:
@bash -c ' \
source ./makefile.sh; \
build; \
echo "Done"; '

buildx:
@bash -c ' \
source ./makefile.sh; \
buildx; \
echo "Done"; '

integration:
@bash -c ' \
source ./makefile.sh; \
integration \
echo "Done"; '
1 change: 1 addition & 0 deletions .devcontainer/apps/ai-travel-advisor/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv/
14 changes: 14 additions & 0 deletions .devcontainer/apps/ai-travel-advisor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.9.20-bookworm

COPY requirements.txt ./
RUN pip install -r requirements.txt
RUN pip install opentelemetry-instrumentation-ollama==0.39.4 --no-deps
RUN pip install -i https://test.pypi.org/simple/ dynatrace-opentelemetry-instrumentation-langchain==0.39.3a1 --no-deps

COPY ./public ./public
COPY ./destinations ./destinations
COPY app.py ./

EXPOSE 8080

CMD [ "python", "app.py"]
17 changes: 17 additions & 0 deletions .devcontainer/apps/ai-travel-advisor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
IMAGE= shinojosa/ai-travel-advisor
VERSION = v1.0.0

build:
docker build -t $(IMAGE):$(VERSION) .

push:
docker push $(IMAGE):$(VERSION)

login:
docker logout && docker login

runnginx:
docker run -p 8080:80 -v /workspaces/enablement-gen-ai-llm-observability/app/public:/usr/share/nginx/html nginx

rollout:
kubectl set image deployment/ai-travel-advisor ai-travel-advisor=$(IMAGE):$(VERSION) -n ai-travel-advisor
Loading