File tree Expand file tree Collapse file tree 4 files changed +25
-11
lines changed Expand file tree Collapse file tree 4 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,18 @@ FROM ghcr.io/newrelic/newrelic-python-agent-ci:${IMAGE_TAG}
44
55# Setup non-root user
66USER root
7- ARG UID=1000
7+ ARG UID=1001
88ARG GID=${UID}
9- ENV HOME /home/vscode
9+ ENV HOME= /home/vscode
1010RUN mkdir -p ${HOME} && \
1111 groupadd --gid ${GID} vscode && \
1212 useradd --uid ${UID} --gid ${GID} --home ${HOME} vscode && \
1313 chown -R ${UID}:${GID} /home/vscode
1414
1515# Fix pyenv installation
1616RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
17- chown -R vscode:vscode ${PYENV_ROOT}
17+ chown -R vscode:vscode "${PYENV_ROOT}" && \
18+ chown -R vscode:vscode "${PIPX_HOME}"
1819
1920# Set user
2021USER ${UID}:${GID}
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ RUN ln -fs "/usr/share/zoneinfo/${TZ}" /etc/localtime && \
8484 dpkg-reconfigure -f noninteractive tzdata
8585
8686# Use root user
87- ENV HOME /root
87+ ENV HOME= /root
8888WORKDIR "${HOME}"
8989
9090# Install pyenv
@@ -96,11 +96,22 @@ RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
9696
9797# Install Python
9898ARG PYTHON_VERSIONS="3.12 3.11 3.10 3.9 3.8 3.7 3.13 pypy3.10-7.3.17"
99- COPY --chown=1000:1000 --chmod=755 ./install-python.sh /tmp/install-python.sh
99+ COPY --chown=0:0 --chmod=755 ./install-python.sh /tmp/install-python.sh
100100RUN /tmp/install-python.sh && \
101101 rm /tmp/install-python.sh
102102
103103# Install dependencies for main python installation
104104COPY ./requirements.txt /tmp/requirements.txt
105105RUN pyenv exec pip install --upgrade -r /tmp/requirements.txt && \
106- rm /tmp/requirements.txt
106+ rm /tmp/requirements.txt
107+
108+ # Install tools with pipx in isolated environments
109+ COPY ./requirements-tools.txt /tmp/requirements-tools.txt
110+ ENV PIPX_HOME="/opt/pipx"
111+ ENV PIPX_BIN_DIR="${PIPX_HOME}/bin"
112+ ENV PATH="${PIPX_BIN_DIR}:${PATH}"
113+ RUN mkdir -p "${PIPX_BIN_DIR}" && \
114+ while IFS="" read -r line || [ -n "$line" ]; do \
115+ pyenv exec pipx install --global "${line}" ; \
116+ done </tmp/requirements-tools.txt && \
117+ rm /tmp/requirements-tools.txt
Original file line number Diff line number Diff line change 1+ bandit
2+ black
3+ flake8
4+ flynt
5+ isort
6+ tox
Original file line number Diff line number Diff line change 1- bandit
2- black
3- flake8
4- isort
51pip
2+ pipx
63setuptools
7- tox
84virtualenv
95wheel
You can’t perform that action at this time.
0 commit comments