Skip to content

Commit 85ae504

Browse files
committed
Continue repo refresh
1 parent 460c3d8 commit 85ae504

File tree

406 files changed

+29751
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

406 files changed

+29751
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
2+
3+
ENV POETRY_VERSION=1.8.2 \
4+
POETRY_VIRTUALENVS_IN_PROJECT=true \
5+
PATH="/root/.local/bin:$PATH"
6+
7+
ARG USERNAME=vscode
8+
ARG WORKDIR=/postgres-agentic-shop
9+
10+
# System Dependencies
11+
RUN apt-get update && apt-get install --no-install-recommends -y \
12+
curl \
13+
ca-certificates \
14+
libicu-dev \
15+
git \
16+
curl \
17+
sudo \
18+
pre-commit \
19+
wget \
20+
jq \
21+
apt-transport-https \
22+
lsb-release \
23+
gnupg \
24+
software-properties-common
25+
26+
# Cleaning cache
27+
RUN rm -rf /var/lib/apt/lists/* \
28+
&& apt-get purge -y --auto-remove \
29+
&& apt-get autoremove \
30+
&& apt-get clean -y
31+
32+
RUN echo "${USERNAME}:${USERNAME}" | chpasswd \
33+
&& adduser ${USERNAME} sudo \
34+
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
35+
36+
# Create docker group and add vscode user to it
37+
RUN if ! getent group docker; then groupadd docker; fi && usermod -aG docker vscode
38+
39+
USER $USERNAME
40+
41+
# Installing `poetry` package manager:
42+
# https://github.com/python-poetry/poetry
43+
RUN curl -sSL https://install.python-poetry.org | python3 -
44+
45+
# add the local bin to the PATH for the non-root user
46+
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
47+
48+
# copy the project files into the container and set ownership
49+
COPY --chown=${USERNAME}:${USERNAME} . ${WORKDIR}
50+
51+
# Set default shell to bash
52+
SHELL ["/bin/bash", "-c"]
53+
54+
# Add this line at the end:
55+
CMD [ "sleep", "infinity" ]

.devcontainer/devcontainer.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"name": "Postgres Agentic Shop",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "agentic-shop",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/postgres-agentic-shop,type=bind,consistency=cached",
6+
"workspaceFolder": "/postgres-agentic-shop",
7+
"features": {
8+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
9+
"ghcr.io/devcontainers/features/node:1": {
10+
"version": "22.14"
11+
},
12+
"ghcr.io/devcontainers/features/azure-cli:1": {
13+
"installBicep": "true",
14+
"extensions": "rdbms-connect"
15+
},
16+
"ghcr.io/azure/azure-dev/azd:latest": {},
17+
"ghcr.io/rchaganti/vsc-devcontainer-features/azurebicep:1": {},
18+
"ghcr.io/devcontainers/features/git:1": {},
19+
"ghcr.io/devcontainers/features/github-cli:1": {},
20+
"ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {},
21+
"ghcr.io/devcontainers/features/powershell:1": {}
22+
},
23+
"remoteEnv": {
24+
// We add the .venv to the beginning of the path env in the Dockerfile
25+
// so that we use the proper python, however vscode rewrites/overwrites
26+
// the PATH in the image and puts /usr/local/bin in front of our .venv
27+
// path. This fixes that issue.
28+
"PATH": "${containerEnv:PATH}",
29+
// Add src folder to PYTHONPATH so that we can import modules that
30+
// are in the source dir
31+
"PYTHONPATH": "/postgres-agentic-shop/backend/:$PATH"
32+
// disable SSL verification for Azure CLI if working in CodeSpaces
33+
// "AZURE_CLI_DISABLE_CONNECTION_VERIFICATION": "1"
34+
},
35+
"mounts": [
36+
// Mounts the ssh details from the host machine - this allows the container to connect to ssh hosts
37+
"type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh",
38+
// Mount docker socket for docker builds
39+
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock",
40+
// Mount bash history
41+
"type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/.bash_history,target=/home/vscode/.bash_history"
42+
],
43+
"runArgs": [
44+
"--network=agentic-net"
45+
],
46+
"forwardPorts": [
47+
8000,
48+
5173
49+
],
50+
"remoteUser": "vscode",
51+
"customizations": {
52+
"vscode": {
53+
"settings": {
54+
"python.defaultInterpreterPath": "${workspaceFolder}/backend/.venv/bin/python",
55+
"python.languageServer": "Pylance",
56+
"files.watcherExclude": {
57+
"**/.git/objects/**": true,
58+
"**/.git/subtree-cache/**": true,
59+
"**/node_modules/*/**": true,
60+
"**/.python_packages/*/**": true
61+
}
62+
},
63+
"extensions": [
64+
"ms-python.python",
65+
"ms-python.debugpy",
66+
"ms-python.pylint",
67+
"ms-python.black-formatter",
68+
"ms-python.vscode-pylance",
69+
"ms-azuretools.vscode-docker",
70+
"ms-azuretools.azure-dev",
71+
"GitHub.copilot",
72+
"GitHub.copilot-chat",
73+
"donjayamanne.githistory",
74+
"codezombiech.gitignore",
75+
"ms-azuretools.vscode-bicep",
76+
"ziyasal.vscode-open-in-github",
77+
"ms-ossdata.vscode-pgsql"
78+
]
79+
}
80+
},
81+
"postCreateCommand": "bash ./.devcontainer/entrypoint.sh",
82+
"postStopCommand": "docker stop arize-phoenix || true"
83+
}

.devcontainer/docker-compose.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
services:
2+
agentic-shop:
3+
build:
4+
context: ../
5+
dockerfile: .devcontainer/Dockerfile
6+
volumes:
7+
- ..:/postgres-agentic-shop:cached
8+
ports:
9+
- "8000:8000"
10+
- "5173:5173"
11+
networks:
12+
- agentic-net
13+
14+
arize-phoenix:
15+
container_name: arize-phoenix
16+
profiles: ["tracing"]
17+
build:
18+
context: ../arize-phoenix
19+
dockerfile: Dockerfile
20+
ports:
21+
- "6006:6006"
22+
- "4317:4317"
23+
volumes:
24+
- phoenix_data:/root/.phoenix/
25+
networks:
26+
- agentic-net
27+
28+
networks:
29+
agentic-net:
30+
name: agentic-net
31+
driver: bridge
32+
33+
volumes:
34+
phoenix_data:
35+
name: phoenix_data

.devcontainer/entrypoint.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
4+
################################
5+
### Docker configuration #######
6+
################################
7+
sudo chmod 666 /var/run/docker.sock
8+
9+
ROOT_DIR=$(pwd)
10+
echo ${ROOT_DIR}
11+
###########################
12+
### Node dependencies #####
13+
###########################
14+
cd ${ROOT_DIR}/frontend
15+
npm install
16+
17+
###########################
18+
### Python dependencies ###
19+
###########################
20+
cd ${ROOT_DIR}/backend
21+
poetry install -v --with dev --no-interaction --directory ${ROOT_DIR}/backend
22+
23+
cd ${ROOT_DIR}
24+
#########################
25+
### Git configuration ###
26+
#########################
27+
git config --global --add safe.directory ${ROOT_DIR}
28+
pre-commit install

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Set default behavior
2+
* text=auto
3+
4+
# Force LF for shell scripts
5+
*.sh text eol=lf
6+
*.sh* text eol=lf

.github/workflows/main.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build and Deploy to Azure Container Apps
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
#push:
8+
branches:
9+
- 'main' # Trigger workflow on pull request closed event to main
10+
paths:
11+
- 'backend/**'
12+
- 'frontend/**'
13+
14+
env:
15+
VITE_BE_APP_ENDPOINT: "https://rt-backend.gentleocean-7b5c46d7.westus3.azurecontainerapps.io"
16+
17+
jobs:
18+
backend-build-and-deploy:
19+
if: github.event.pull_request.merged == true
20+
runs-on: ubuntu-latest
21+
permissions: write-all
22+
23+
steps:
24+
- name: 🛎 Checkout Repository
25+
uses: actions/checkout@v4
26+
27+
- name: 🔍 Log in to Azure
28+
uses: azure/login@v1
29+
with:
30+
creds: ${{ secrets.AZURE_CREDENTIALS }}
31+
32+
- name: "Folder change check"
33+
uses: dorny/paths-filter@v3
34+
id: backend
35+
with:
36+
filters: |
37+
backend:
38+
- "backend/**"
39+
40+
- name: 🔐 Log in to Azure Container Registry (ACR)
41+
if: steps.backend.outputs.backend == 'true'
42+
run: |
43+
az acr login --name ${{ secrets.ACR_NAME }}
44+
45+
- name: 🔨 Build Docker Image with Commit ID as Tag
46+
if: steps.backend.outputs.backend == 'true'
47+
run: |
48+
COMMIT_ID=$(git rev-parse --short HEAD)
49+
echo "IMAGE_TAG=$COMMIT_ID" >> $GITHUB_ENV
50+
cd backend
51+
docker build -t ${{ secrets.ACR_NAME }}.azurecr.io/retail-solution-accelerator/backend-dev-agenticshop:$COMMIT_ID .
52+
53+
- name: 🚀 Push Image to ACR
54+
if: steps.backend.outputs.backend == 'true'
55+
run: |
56+
docker push ${{ secrets.ACR_NAME }}.azurecr.io/retail-solution-accelerator/backend-dev-agenticshop:$IMAGE_TAG
57+
58+
- name: 🎯 Deploy to Azure Container Apps
59+
if: steps.backend.outputs.backend == 'true'
60+
run: |
61+
az containerapp update \
62+
--name ${{ secrets.CONTAINER_APP_NAME_BACKEND }} \
63+
--resource-group ${{ secrets.RESOURCE_GROUP }} \
64+
--image ${{ secrets.ACR_NAME }}.azurecr.io/retail-solution-accelerator/backend-dev-agenticshop:$IMAGE_TAG
65+
66+
frontend-build-and-deploy:
67+
if: github.event.pull_request.merged == true
68+
runs-on: ubuntu-latest
69+
permissions: write-all
70+
71+
steps:
72+
- name: 🛎 Checkout Repository
73+
uses: actions/checkout@v4
74+
75+
- name: 🔍 Log in to Azure
76+
uses: azure/login@v1
77+
with:
78+
creds: ${{ secrets.AZURE_CREDENTIALS }}
79+
80+
- name: "Folder change check"
81+
uses: dorny/paths-filter@v3
82+
id: frontend
83+
with:
84+
filters: |
85+
frontend:
86+
- "frontend/**"
87+
88+
- name: 🔐 Log in to Azure Container Registry (ACR)
89+
if: steps.frontend.outputs.frontend == 'true'
90+
run: |
91+
az acr login --name ${{ secrets.ACR_NAME }}
92+
93+
- name: 🔨 Build Docker Image with Commit ID as Tag
94+
if: steps.frontend.outputs.frontend == 'true'
95+
run: |
96+
COMMIT_ID=$(git rev-parse --short HEAD)
97+
echo "IMAGE_TAG=$COMMIT_ID" >> $GITHUB_ENV
98+
cd frontend
99+
echo "VITE_BE_APP_ENDPOINT="https://rt-backend.gentleocean-7b5c46d7.westus3.azurecontainerapps.io/"" >> .env.local
100+
docker build -t ${{ secrets.ACR_NAME }}.azurecr.io/retail-solution-accelerator/frontend-dev-agenticshop:$COMMIT_ID .
101+
102+
- name: 🚀 Push Image to ACR
103+
if: steps.frontend.outputs.frontend == 'true'
104+
run: |
105+
docker push ${{ secrets.ACR_NAME }}.azurecr.io/retail-solution-accelerator/frontend-dev-agenticshop:$IMAGE_TAG
106+
107+
- name: 🎯 Deploy to Azure Container Apps
108+
if: steps.frontend.outputs.frontend == 'true'
109+
run: |
110+
az containerapp update \
111+
--name ${{ secrets.CONTAINER_APP_NAME_FRONTEND }} \
112+
--resource-group ${{ secrets.RESOURCE_GROUP }} \
113+
--image ${{ secrets.ACR_NAME }}.azurecr.io/retail-solution-accelerator/frontend-dev-agenticshop:$IMAGE_TAG

0 commit comments

Comments
 (0)