mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
Having dev containers makes its easier, faster and secure to setup the dev environment for the repository. The pull request consists of: - .devcontainer folder with: - **devcontainer.json :** (minimal necessary vscode extensions and settings) - **docker-compose.yaml :** (could be modified to run necessary services as per need. Ex vectordbs, databases) - **Dockerfile:**(non root with dev tools) - Changes to README - added the Open in Github Codespaces Badge - added the Open in dev container Badge Co-authored-by: Jinto Jose <129657162+jj701@users.noreply.github.com>
This commit is contained in:
parent
d86ed15d88
commit
ac0a9d02bd
42
.devcontainer/Dockerfile
Normal file
42
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# This is a Dockerfile for Developer Container
|
||||||
|
|
||||||
|
# Use the Python base image
|
||||||
|
ARG VARIANT="3.11-bullseye"
|
||||||
|
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} AS langchain-dev-base
|
||||||
|
|
||||||
|
USER vscode
|
||||||
|
|
||||||
|
# Define the version of Poetry to install (default is 1.4.2)
|
||||||
|
# Define the directory of python virtual environment
|
||||||
|
ARG PYTHON_VIRTUALENV_HOME=/home/vscode/langchain-py-env \
|
||||||
|
POETRY_VERSION=1.4.2
|
||||||
|
|
||||||
|
ENV POETRY_VIRTUALENVS_IN_PROJECT=false \
|
||||||
|
POETRY_NO_INTERACTION=true
|
||||||
|
|
||||||
|
# Create a Python virtual environment for Poetry and install it
|
||||||
|
RUN python3 -m venv ${PYTHON_VIRTUALENV_HOME} && \
|
||||||
|
$PYTHON_VIRTUALENV_HOME/bin/pip install --upgrade pip && \
|
||||||
|
$PYTHON_VIRTUALENV_HOME/bin/pip install poetry==${POETRY_VERSION}
|
||||||
|
|
||||||
|
ENV PATH="$PYTHON_VIRTUALENV_HOME/bin:$PATH" \
|
||||||
|
VIRTUAL_ENV=$PYTHON_VIRTUALENV_HOME
|
||||||
|
|
||||||
|
# Setup for bash
|
||||||
|
RUN poetry completions bash >> /home/vscode/.bash_completion && \
|
||||||
|
echo "export PATH=$PYTHON_VIRTUALENV_HOME/bin:$PATH" >> ~/.bashrc
|
||||||
|
|
||||||
|
# Set the working directory for the app
|
||||||
|
WORKDIR /workspaces/langchain
|
||||||
|
|
||||||
|
# Use a multi-stage build to install dependencies
|
||||||
|
FROM langchain-dev-base AS langchain-dev-dependencies
|
||||||
|
|
||||||
|
ARG PYTHON_VIRTUALENV_HOME
|
||||||
|
|
||||||
|
# Copy only the dependency files for installation
|
||||||
|
COPY pyproject.toml poetry.lock poetry.toml ./
|
||||||
|
|
||||||
|
# Install the Poetry dependencies (this layer will be cached as long as the dependencies don't change)
|
||||||
|
RUN poetry install --no-interaction --no-ansi --with dev,test,docs
|
||||||
|
|
33
.devcontainer/devcontainer.json
Normal file
33
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
|
||||||
|
{
|
||||||
|
"dockerComposeFile": "./docker-compose.yaml",
|
||||||
|
"service": "langchain",
|
||||||
|
"workspaceFolder": "/workspaces/langchain",
|
||||||
|
"name": "langchain",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.python"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"python.defaultInterpreterPath": "/home/vscode/langchain-py-env/bin/python3.11"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
"features": {},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Uncomment the next line to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "cat /etc/os-release",
|
||||||
|
|
||||||
|
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "devcontainer"
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"overrideCommand": true
|
||||||
|
}
|
31
.devcontainer/docker-compose.yaml
Normal file
31
.devcontainer/docker-compose.yaml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
langchain:
|
||||||
|
build:
|
||||||
|
dockerfile: .devcontainer/Dockerfile
|
||||||
|
context: ../
|
||||||
|
volumes:
|
||||||
|
- ../:/workspaces/langchain
|
||||||
|
networks:
|
||||||
|
- langchain-network
|
||||||
|
# environment:
|
||||||
|
# MONGO_ROOT_USERNAME: root
|
||||||
|
# MONGO_ROOT_PASSWORD: example123
|
||||||
|
# depends_on:
|
||||||
|
# - mongo
|
||||||
|
# mongo:
|
||||||
|
# image: mongo
|
||||||
|
# restart: unless-stopped
|
||||||
|
# environment:
|
||||||
|
# MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
# MONGO_INITDB_ROOT_PASSWORD: example123
|
||||||
|
# ports:
|
||||||
|
# - "27017:27017"
|
||||||
|
# networks:
|
||||||
|
# - langchain-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
langchain-network:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
⚡ Building applications with LLMs through composability ⚡
|
⚡ Building applications with LLMs through composability ⚡
|
||||||
|
|
||||||
[](https://github.com/hwchase17/langchain/actions/workflows/lint.yml) [](https://github.com/hwchase17/langchain/actions/workflows/test.yml) [](https://github.com/hwchase17/langchain/actions/workflows/linkcheck.yml) [](https://pepy.tech/project/langchain) [](https://opensource.org/licenses/MIT) [](https://twitter.com/langchainai) [](https://discord.gg/6adMQxSpJS)
|
[](https://github.com/hwchase17/langchain/actions/workflows/lint.yml) [](https://github.com/hwchase17/langchain/actions/workflows/test.yml) [](https://github.com/hwchase17/langchain/actions/workflows/linkcheck.yml) [](https://pepy.tech/project/langchain) [](https://opensource.org/licenses/MIT) [](https://twitter.com/langchainai) [](https://discord.gg/6adMQxSpJS) [](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/hwchase17/langchain) [](https://codespaces.new/hwchase17/langchain)
|
||||||
|
|
||||||
|
|
||||||
Looking for the JS/TS version? Check out [LangChain.js](https://github.com/hwchase17/langchainjs).
|
Looking for the JS/TS version? Check out [LangChain.js](https://github.com/hwchase17/langchainjs).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user