forked from Azure-Samples/graphrag-accelerator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add all dot files back (Azure-Samples#25)
- Loading branch information
1 parent
651ffd6
commit 46d5c22
Showing
9 changed files
with
22,149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
trigger: | ||
- main | ||
|
||
pool: | ||
vmImage: ubuntu-latest | ||
|
||
steps: | ||
- task: PoliCheck@2 | ||
displayName: 'Run PoliCheck' | ||
inputs: | ||
targetType: 'F' | ||
targetArgument: '$(Build.SourcesDirectory)' | ||
result: 'PoliCheck.xml' | ||
toolVersion: Latest | ||
- script: docker build -t graphrag:backend -f docker/Dockerfile-backend . | ||
displayName: 'Build backend docker image' | ||
- script: docker build -t graphrag:frontend -f docker/Dockerfile-frontend . | ||
displayName: 'Build frontend docker image' | ||
# Component Governance does not support pyproject.toml yet. | ||
# For that reason, use toml-to-requirements to export the | ||
# dependencies into a requirements.txt file. | ||
- script: | | ||
pip install toml-to-requirements | ||
toml-to-req --toml-file pyproject.toml --poetry --optional-lists dev,test,backend,frontend | ||
# toml-to-req is not perfect. It will leave wildcard characters in the requirements.txt file which we remove | ||
sed -i 's/\*//g' requirements.txt | ||
displayName: 'Export python dependencies to requirements.txt' | ||
- task: ComponentGovernanceComponentDetection@0 | ||
displayName: 'Component Governance - Component Detection' | ||
inputs: | ||
scanType: 'Register' | ||
verbosity: 'Verbose' | ||
alertWarningLevel: 'High' | ||
dockerImagesToScan: graphrag:backend,graphrag:frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
FROM python:3.10 | ||
|
||
# avoid common warnings | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV PIP_ROOT_USER_ACTION=ignore | ||
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 | ||
|
||
# configure environment | ||
ARG ENVNAME="GraphRAG" | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1001 | ||
ARG USER_GID=$USER_UID | ||
ARG WORKDIR=/${ENVNAME} | ||
|
||
# install python, pip, git, and other required tools | ||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
libicu-dev \ | ||
git \ | ||
curl \ | ||
sudo \ | ||
pre-commit \ | ||
wget \ | ||
jq \ | ||
apt-transport-https \ | ||
lsb-release \ | ||
gnupg \ | ||
software-properties-common | ||
# install Azure CLI | ||
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
RUN az bicep install | ||
# install kubectl | ||
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ | ||
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | ||
# install helm | ||
RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 \ | ||
&& chmod 700 get_helm.sh \ | ||
&& ./get_helm.sh \ | ||
&& rm ./get_helm.sh | ||
# install yq | ||
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq \ | ||
&& chmod +x /usr/bin/yq | ||
|
||
# install docker | ||
RUN curl -fsSL https://get.docker.com -o install-docker.sh \ | ||
&& sh install-docker.sh \ | ||
&& rm install-docker.sh | ||
|
||
# cleanup to keep the image size down | ||
RUN rm -rf /var/lib/apt/lists/* \ | ||
&& apt-get purge -y --auto-remove \ | ||
&& apt-get autoremove \ | ||
&& apt-get clean | ||
|
||
# set the location for the virtual environments to be outside the project directory | ||
ENV POETRY_VIRTUALENVS_IN_PROJECT=true | ||
|
||
# set up non-root user | ||
RUN useradd -ms /bin/bash -u ${USER_GID} ${USERNAME} \ | ||
&& echo "${USERNAME}:${USERNAME}" | chpasswd \ | ||
# add user to sudo group and docker group | ||
&& adduser ${USERNAME} sudo \ | ||
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \ | ||
&& usermod -aG docker ${USERNAME} | ||
|
||
# switch to non-root user | ||
USER ${USERNAME} | ||
|
||
# install poetry | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# add the local bin to the PATH for the non-root user | ||
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}" | ||
# Add venv to beginning of path so we don't have to activate it | ||
ENV PATH=/graphrag-accelerator/.venv/bin:$PATH | ||
|
||
# copy the project files into the container and set ownership | ||
COPY --chown=${USERNAME}:${USER_GID} . ${WORKDIR} | ||
|
||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
||
# Create directories for vscode server and extensions | ||
RUN mkdir -p /home/$USERNAME/.vscode-server/extensions \ | ||
&& chown -R $USER_UID:$USER_GID /home/$USERNAME/.vscode-server | ||
|
||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"name": "graphrag-accelerator", | ||
"build": { | ||
"dockerfile": "./Dockerfile", | ||
"args": { | ||
"DOCKER_GROUP_ID": "${localEnv:DOCKER_GROUP_ID}" | ||
} | ||
}, | ||
"forwardPorts": [ 7071 ], | ||
"runArgs": [ | ||
"--network", "host" // use host networking so that the dev container can access the API when running the container locally | ||
], | ||
"remoteUser": "vscode", | ||
"remoteEnv": { | ||
// We add the .venv to the beginning of the path env in the Dockerfile | ||
// so that we use the proper python, however vscode rewrites/overwrites | ||
// the PATH in the image and puts /usr/local/bin in front of our .venv | ||
// path. This fixes that issue. | ||
"PATH": "${containerEnv:PATH}", | ||
// Add src folder to PYTHONPATH so that we can import modules that | ||
// are in the source dir | ||
"PYTHONPATH": "/graphrag-accelerator/backend/:$PATH" | ||
}, | ||
"mounts": [ | ||
// Keep command history | ||
"type=volume,source=graphrag-bashhistory,target=/home/vscode/command_history", | ||
"type=volume,source=graphrag-devcontainer-vscode-server,target=/home/vscode/.vscode-server/extensions", | ||
// Mounts the login details from the host machine so azcli works seamlessly in the container | ||
// "type=bind,source=${localEnv:HOME}/.azure,target=/home/vscode/.azure", | ||
// Mounts the ssh details from the host machine - this allows the container to connect to ssh hosts | ||
"type=bind,source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh", | ||
// Mount docker socket for docker builds | ||
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"python.pythonPath": "/graphrag-accelerator/.venv/bin/python", | ||
"python.defaultInterpreterPath": "/graphrag-accelerator/.venv/bin/python", | ||
"python.languageServer": "Pylance", | ||
"files.watcherExclude": { | ||
"**/.git/objects/**": true, | ||
"**/.git/subtree-cache/**": true, | ||
"**/node_modules/*/**": true, | ||
"**/.python_packages/*/**": true | ||
}, | ||
"files.associations": { | ||
"*.workbook": "[jsonc]" | ||
}, | ||
"ruff.interpreter": [ | ||
"/graphrag-accelerator/.venv/bin/python" | ||
], | ||
"ruff.lint.args": [ | ||
"--config", | ||
"/graphrag-accelerator/pyproject.toml" | ||
], | ||
"ruff.lint.run": "onType" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"donjayamanne.githistory", | ||
"codezombiech.gitignore", | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat", | ||
"ms-azuretools.vscode-docker", | ||
"ms-azuretools.vscode-bicep", | ||
"ms-dotnettools.vscode-dotnet-runtime", | ||
"ms-kubernetes-tools.vscode-kubernetes-tools", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-toolsai.datawrangler", | ||
"ms-toolsai.jupyter", | ||
"ms-toolsai.jupyter-keymap", | ||
"ms-toolsai.vscode-jupyter-cell-tags", | ||
"ms-toolsai.vscode-jupyter-slideshow", | ||
"ziyasal.vscode-open-in-github", | ||
"charliermarsh.ruff" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "bash /usr/local/bin/entrypoint.sh", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/graphrag-accelerator,type=bind,consistency=cached", | ||
"workspaceFolder": "/graphrag-accelerator" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
################################ | ||
### Docker configuration ### | ||
################################ | ||
sudo chmod 666 /var/run/docker.sock | ||
|
||
################################ | ||
### Dependency configuration ### | ||
################################ | ||
|
||
# Install graphrag dependencies | ||
cd /graphrag-accelerator | ||
poetry install --no-interaction -v | ||
|
||
######################### | ||
### Git configuration ### | ||
######################### | ||
|
||
git config --global --add safe.directory /graphrag-accelerator | ||
pre-commit install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
notebooks | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
.github | ||
.git | ||
**/__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
**/.pytest_cache | ||
**/.ruff_cache | ||
**/.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# all files are checked into the repo with LF | ||
* text=auto |
Oops, something went wrong.