Poetry is a tool for dependency management and packaging in Python.
See the website for more information.
FROM chazw/poetry
WORKDIR /app
COPY . .
RUN poetry install --no-dev
CMD ["python", "./your-script.py"]
or for applications with a command-line interface:
FROM chazw/poetry
WORKDIR /app
COPY . .
RUN poetry install --no-dev --develop .
CMD ["app-cli-name", "your-command"]
Current preview
has issues with toggling off the creation of virtual environments inside of a docker container. Reference pull request. Typically we would run poetry install ...
, but must instead export to requirements.txt
as a workaround.
FROM chazw/poetry:preview
WORKDIR /app
COPY . .
RUN poetry export -f requirements.txt --dev --without-hashes \
&& pip install --no-cache-dir -r requirements.txt -q
CMD ["python", "./your-script.py"]
or for applications with a command-line interface:
FROM chazw/poetry:preview
WORKDIR /app
COPY . .
RUN poetry export -f requirements.txt --dev --without-hashes \
&& pip install --no-cache-dir -r requirements.txt -q \
&& pip install -q --no-cache-dir .
CMD ["app-cli-name", "your-command"]
The poetry
images come in many variants for specific versions of python
and the needed use case.
Default image for the latest version of poetry
and python
.
Image for the latest version of poetry
and python
slim variant.
Image for the preview version of poetry
and latest version python
. Used for access latest features for poetry
not yet in an official release.
Image for the preview version of poetry
and latest version python
slim variant. Used for access latest features for poetry
not yet in an official release.