Can you create a dockerfile that installs Poetry?
Jump to turn (9)
- 1Can you create a dockerfile that installs Poetry?
- 2This uses the old poetry installer, can you generate a dockerfile that uses the
- 3The new installer lives at install.python-poetry.org
- 4I need to use Python 3.10.
- 5Can you extend the Dockerfile to also install my own code and its dependencies?
- 6I want to use multiple build stages such that the final image does not contain p
- 7My source code lives in the src subdirectory.
- 8Does this actually copy the dependencies from the builder stage?
- 9poetry doesn't install the dependencies in the /app directory.
- User
Can you create a dockerfile that installs Poetry?
- Assistant
Certainly! Here's a Dockerfile that installs Poetry:
sqlFROM python:3.9-slim-buster RUN apt-get update && apt-get install -y curl && \ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - ENV PATH="${PATH}:/root/.poetry/bin" CMD [ "poetry", "--version" ]This Dockerfile starts with the official Python 3.9 slim-buster image, updates the package list, installs curl, and runs a curl command to download and install Poetry.
After installation, it sets the PATH environment variable to include the Poetry executable, and sets the default command to display the Poetry version using .