1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16- FROM ubuntu:20 .04
16+ FROM ubuntu:24 .04
1717ARG TARGETPLATFORM
1818
1919# Install OS packages
@@ -23,33 +23,15 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
2323 bash \
2424 build-essential \
2525 curl \
26- default-libmysqlclient-dev \
27- expat \
2826 fish \
2927 fontconfig \
30- freetds-common \
31- freetds-dev \
3228 gcc \
3329 git \
34- libbz2-dev \
35- libcurl4-openssl-dev \
36- libffi-dev \
37- libgmp-dev \
38- libkrb5-dev \
39- liblzma-dev \
40- libmpfr-dev \
41- libncurses-dev \
42- libpq-dev \
43- libreadline-dev \
44- libsqlite3-dev \
45- libssl-dev \
4630 locales \
4731 make \
4832 odbc-postgresql \
4933 openssl \
5034 pkg-config \
51- python3-dev \
52- python3-pip \
5335 rustc \
5436 sudo \
5537 tzdata \
@@ -58,8 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
5840 vim \
5941 wget \
6042 zip \
61- zlib1g \
62- zlib1g-dev \
6343 zsh && \
6444 rm -rf /var/lib/apt/lists/*
6545
@@ -103,36 +83,32 @@ RUN ln -fs "/usr/share/zoneinfo/${TZ}" /etc/localtime && \
10383ENV HOME=/root
10484WORKDIR "${HOME}"
10585
106- # Install pyenv
107- ENV PYENV_ROOT="/usr/local/pyenv"
108- RUN curl https://pyenv.run/ | /bin/bash
109- ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
110- RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
111- pyenv update
86+ # Install and configure uv
87+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
88+ ENV PATH="${HOME}/.local/bin:${PATH}"
89+ ENV UV_PYTHON_PREFERENCE="only-managed"
11290
11391# Install Python
114- ARG PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 pypy3.10-7.3.17"
115- COPY --chown=0:0 --chmod=755 ./install-python.sh /tmp/install-python.sh
116- RUN /tmp/install-python.sh && \
117- rm /tmp/install-python.sh
92+ ARG PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 pypy3.10"
93+ RUN bash -c "uv python install ${PYTHON_VERSIONS}" && \
94+ uv python pin --global 3.13
11895
119- # Install dependencies for main python installation
120- COPY ./requirements.txt /tmp/requirements.txt
121- RUN pyenv exec pip install --upgrade -r /tmp/requirements.txt && \
122- rm /tmp/requirements.txt
96+ # Add shims for python and pip
97+ COPY --chmod=775 <<EOF "${HOME}/.local/bin/python"
98+ # !/bin/bash
99+ exec uv run --no-project python \$ @
100+ EOF
123101
124- # Install tools with pipx in isolated environments
125- COPY ./requirements-tools.txt /tmp/requirements-tools.txt
126- ENV PIPX_HOME="/opt/pipx"
127- ENV PIPX_BIN_DIR="${PIPX_HOME}/bin"
128- ENV PATH="${PIPX_BIN_DIR}:${PATH}"
129- RUN mkdir -p "${PIPX_BIN_DIR}" && \
130- while IFS="" read -r line || [ -n "$line" ]; do \
131- pyenv exec pipx install --global "${line}" ; \
132- done </tmp/requirements-tools.txt && \
133- rm /tmp/requirements-tools.txt
102+ COPY --chmod=775 <<EOF "${HOME}/.local/bin/pip"
103+ # !/bin/bash
104+ exec uv pip \$ @
105+ EOF
134106
135- # Inject compatibile dependencies for tox
136- COPY ./requirements-tox.txt /tmp/requirements-tox.txt
137- RUN pipx inject --force tox -r /tmp/requirements-tox.txt && \
138- rm /tmp/requirements-tox.txt
107+ # Prevent any runtime downloads
108+ ENV UV_PYTHON_DOWNLOADS=never
109+
110+ # Install tools with uv in isolated environments
111+ RUN uv tool install tox==4.23.2 --with tox-uv && \
112+ uv tool install ruff && \
113+ uv tool install pre-commit --with pre-commit-uv && \
114+ uv tool install asv --with virtualenv
0 commit comments