None
SQ
Best practices for using Python & Poetry inside Docker
['Ashish Bhatia']
ashishb.net
Bash 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # Install poetry $ pip3 install poetry == 2.0.1 $ poetry --version Poetry ( version 2.0.1 ) # Create a sample package $ poetry init --python = ~3.10 --name = src --description = 'Flask Hello world' --dependency = Flask@3.0.0 --author = 'Ashish' --license = 'Apache 2.0' --no-interaction $ poetry install $ touch README.md $ mkdir src # Create a file src/server.py in your favorite editor $ cat src/server.py from flask import Flask app = Flask ( __name__ ) @app.route ( "/" ) def hello_world () : return "<p>Hello, World!</p>" if __name__ == "__main__" : app.run () Dockerfile 1 2 3 4 5 6 7 8 9 10 11 FROM python:3.10-slim as base # Install Poetry RUN pip3 install poetry == 2.0.1 WORKDIR /app COPY pyproject.toml poetry.lock /app #…