Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always-copy creating a symlink in docker build #7873

Closed
4 tasks done
postera-james opened this issue May 3, 2023 · 3 comments
Closed
4 tasks done

always-copy creating a symlink in docker build #7873

postera-james opened this issue May 3, 2023 · 3 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@postera-james
Copy link

  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I have written a multi-stage Dockerfile based off some of the discussions found on this repo's issues.

# syntax=docker/dockerfile:1.4
FROM ubuntu:20.04 as base-build-stage

WORKDIR /example

RUN DEBIAN_FRONTEND=noninteractive apt update && apt-get install -y --no-install-recommends tzdata

RUN --mount=type=cache,target=/var/cache/apt apt update  && apt install -y software-properties-common wget libxrender1 libxext6 libsm6 git build-essential curl \ 
    && add-apt-repository -y 'ppa:deadsnakes/ppa' \
    &&  apt install  -y python3.10 python3.10-dev python3.10-distutils \
    && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
    && python3.10 get-pip.py \
    && rm get-pip.py \
    && python3.10 -m pip install --upgrade requests 


ENV POETRY_VERSION=1.4.2 \
    POETRY_HOME="/opt/poetry" \
    POETRY_VIRTUALENVS_IN_PROJECT=true \
    POETRY_NO_INTERACTION=1 \
    PYSETUP_PATH="/opt/pysetup" \
    VENV_PATH="/example/.venv" \
    POETRY_VIRTUALENVS_OPTIONS_ALWAYS_COPY=true 
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"

RUN curl -sSL https://install.python-poetry.org | python3.10 - \
    && python3.10 -m pip install poethepoet \
    && poetry config --list

COPY ./pyproject.toml  ./

RUN --mount=type=cache,target=/root/.cache \
    poetry install --no-root   

RUN ls -lha /example/.venv/bin 

My eventual goal is to copy the virtualenv over to another stage, so I'm setting POETRY_VIRTUALENVS_OPTIONS_ALWAYS_COPY=true.

I expected that this would mean the venv would contain an executable, not a symlink.
The poetry config --list returns that the setting is reflected:

#13 11.90 cache-dir = "/root/.cache/pypoetry"
#13 11.90 experimental.new-installer = true
#13 11.90 experimental.system-git-client = false
#13 11.90 installer.max-workers = null
#13 11.90 installer.modern-installation = true
#13 11.90 installer.no-binary = null
#13 11.90 installer.parallel = true
#13 11.90 virtualenvs.create = true
#13 11.90 virtualenvs.in-project = true
#13 11.90 virtualenvs.options.always-copy = true
#13 11.90 virtualenvs.options.no-pip = false
#13 11.90 virtualenvs.options.no-setuptools = false
#13 11.90 virtualenvs.options.system-site-packages = false
#13 11.90 virtualenvs.path = "{cache-dir}/virtualenvs"  # /root/.cache/pypoetry/virtualenvs
#13 11.90 virtualenvs.prefer-active-python = false
#13 11.90 virtualenvs.prompt = "{project_name}-py{python_version}"

The last RUN indicates however that it's just a symlink still:

#16 0.334 lrwxrwxrwx 1 root root   19 May  3 22:26 python -> /usr/bin/python3.10
#16 0.334 lrwxrwxrwx 1 root root    6 May  3 22:26 python3 -> python
#16 0.334 lrwxrwxrwx 1 root root    6 May  3 22:26 python3.10 -> python

Hope I'm not missing anything obvious!

@postera-james postera-james added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 3, 2023
@dimbleby
Copy link
Contributor

dimbleby commented May 4, 2023

duplicate #5906

@postera-james
Copy link
Author

postera-james commented May 4, 2023

I tested without using envs and it works, thanks for the quick turnaround.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants