forked from Archives/langchain
added all extra dependencies to dev image + customized builds
- downgraded to python 3.10 to accomadate installing all dependencies - by default installs all dev + extra dependencies - option to install only dev dependencies by customizing .env filemain
parent
f1dc03d0cc
commit
97c2b31cc5
@ -1,6 +1,10 @@
|
||||
# python env
|
||||
PYTHON_VERSION=3.11.2
|
||||
PYTHON_VERSION=3.10
|
||||
|
||||
# langchain env
|
||||
# -E flag is required
|
||||
# comment the following line to only install dev dependencies
|
||||
POETRY_EXTRA_PACKAGES="-E all"
|
||||
|
||||
# langchain env. warning: these variables will be baked into the docker image !
|
||||
OPENAI_API_KEY=${OPENAI_API_KEY:-}
|
||||
SERPAPI_API_KEY=${SERPAPI_API_KEY:-}
|
||||
|
@ -0,0 +1,39 @@
|
||||
## Using Docker
|
||||
|
||||
To quickly get started, run the command `make docker`.
|
||||
|
||||
If docker is installed the Makefile will export extra targets in the fomrat `docker.*` to build and run the docker image. Type `make` for a list of common tasks.
|
||||
|
||||
### Building the development image
|
||||
|
||||
- use `make docker.run` will build the dev image if it does not exist.
|
||||
- `make docker.build`
|
||||
|
||||
#### Customizing the image and installed dependencies
|
||||
|
||||
The image is built with a default python version and all extras and dev
|
||||
dependencies. It can be customized by changing the variables in the [.env](/docker/.env)
|
||||
file.
|
||||
|
||||
If you don't need all the `extra` dependencies a slimmer image can be obtained by
|
||||
commenting out `POETRY_EXTRA_PACKAGES` in the [.env](docker/.env) file.
|
||||
|
||||
#### Image caching
|
||||
|
||||
The Dockerfile is optimized to cache the poetry install step. A rebuild is triggered when there a change to the source code.
|
||||
|
||||
### Example Usage
|
||||
|
||||
All commands that in the python env are available by default in the container.
|
||||
|
||||
A few examples:
|
||||
```bash
|
||||
# run jupyter notebook
|
||||
docker run --rm -it IMG jupyter notebook
|
||||
|
||||
# run ipython
|
||||
docker run --rm -it IMG ipython
|
||||
|
||||
# start web server
|
||||
docker run --rm -p 8888:8888 IMG python -m http.server 8888
|
||||
```
|
@ -1,9 +1,8 @@
|
||||
The dependencies have been installed in the current shell.
|
||||
There is no virtualenv or a need for `poetry` inside the
|
||||
container.
|
||||
All dependencies have been installed in the current shell. There is no
|
||||
virtualenv or a need for `poetry` inside the container.
|
||||
|
||||
Running the command `make docker.run` at the root directory
|
||||
of the project will build the container the first time. On
|
||||
the next runs, it will use the cached image or rebuild it if
|
||||
a change is made on the source code.
|
||||
Running the command `make docker.run` at the root directory of the project will
|
||||
build the container the first time. On the next runs it will use the cached
|
||||
image. A rebuild will happen when changes are made to the source code.
|
||||
|
||||
You local source directory has been mounted to the /src directory.
|
||||
|
Loading…
Reference in New Issue