Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Dockerfile
- FROM python:3.12-slim-bullseye as python-base
- ENV PYTHONUNBUFFERED=1 \
- PIP_DISABLE_PIP_VERSION_CHECK=on \
- PIP_DEFAULT_TIMEOUT=100 \
- POETRY_VERSION=1.8.2 \
- POETRY_HOME="/opt/poetry" \
- POETRY_CACHE_DIR="/root/.cache/pypoetry" \
- POETRY_VIRTUALENVS_IN_PROJECT=1 \
- POETRY_NO_INTERACTION=1 \
- VENV_PATH="/.venv"
- ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
- RUN apt-get update \
- && apt-get install --no-install-recommends -y \
- curl \
- build-essential
- RUN --mount=type=cache,target="/root/.cache" \
- curl -sSL https://install.python-poetry.org | python -
- COPY pyproject.toml poetry.lock ./
- COPY src/test_poetry/ src/test_poetry
- RUN --mount=type=cache,target=$POETRY_CACHE_DIR \
- poetry install --only-root
- CMD ["python", "src/test_poetry/main.py"]
- # pyproject.toml
- [tool.poetry]
- name = "test-poetry"
- version = "0.1.0"
- description = ""
- authors = ["Kyrylo <[email protected]>"]
- readme = "README.md"
- packages = [{include = "test_poetry", from = "src"}]
- [tool.poetry.dependencies]
- python = "^3.12"
- [build-system]
- requires = ["poetry-core"]
- build-backend = "poetry.core.masonry.api"
- # main.py
- import sys
- print(sys.path)
- # Error happens here when run in docker
- from test_poetry.views import test
Advertisement
Add Comment
Please, Sign In to add comment