[Python] Running poetry in using jenkins dockerfile

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    I've got my dockerfile

    FROM git.corp.com:4567/some/python:3.11-slim

    RUN apt update; \
    apt install pipx -y; \
    pipx install poetry; \
    pipx ensurepath; \
    chmod a +rx /root/.local/bin/poetry; \
    ln -s /root/.local/bin/poetry /usr/bin/poetry; \


    and my jenkins stage

    stage('Test') {
    agent {
    dockerfile{
    filename 'Dockerfile.build'
    args "-v $WORKSPACE:/app"
    reuseNode true
    }
    }
    steps {
    sh """
    ls -l poetry
    poetry install --no-root -E tests -E mypy -E lint
    PYTHONPATH="$PWD/src" pytest
    """
    }
    }


    Why do I get this message?

    script.sh.copy: 3: poetry: Permission denied


    I've changed permessions using chmod a +rx

    ls -l poetry output looks like this

    lrwxrwxrwx 1 root root 23 Apr 11 10:02 /usr/bin/poetry -> /root/.local/bin/poetry


    I know Jenkins pass -u 1000:1000 arguments to docker run command but shouldn't chmod fix this?

    Continue reading...

Compartilhe esta Página