Skip to content

Commit 3dcb7bf

Browse files
committed
chore: improve Dockerfile for ci tests
1 parent fa6bd2c commit 3dcb7bf

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

.github/workflows/rw-collect-changes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ jobs:
4242
- 'packages/**'
4343
- '*.mk'
4444
- 'Makefile'
45+
- Dockerfile
46+
- pyproject.toml

Dockerfile

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@ FROM python:${PY_TAG}
44

55
ARG PY_TAG
66
ARG ENV_TAG
7+
ARG UV_VERSION=0.9.5
8+
79
# tox defines all python targets, makefile recognizes TEST_ENVS and forces
810
# tox to execute only tests for installed python
911
ENV TEST_ENVS=${ENV_TAG}
1012

1113
# install make and gosu
14+
# install uv using pip
15+
# UV_VERSION should match pyproject.toml [tool.uv] required-version (currently 0.9.5)
1216
ENV GOSU_VERSION=1.14
1317
RUN set -x \
1418
&& apt-get update \
1519
&& apt-get install -y --no-install-recommends make curl gnupg \
20+
&& pip install --no-cache-dir "uv==${UV_VERSION}" \
1621
&& curl -sSLo /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
1722
&& curl -sSLo /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
1823
&& export GNUPGHOME="$(mktemp -d)" \
@@ -26,17 +31,27 @@ RUN set -x \
2631
&& rm -rf /var/lib/apt/lists/* \
2732
&& true
2833

29-
# install tox
30-
ENV PYTHON_TOX_VERSION=4.30.0
31-
ENV PYTHON_TOX_UV_VERSION=1.28.0
32-
# install uv
33-
ENV PYTHON_UV_VERSION=0.9.5
34+
# Set working directory before copying files
35+
WORKDIR /data
36+
37+
# copy dependency files - these will be available at build time
38+
# At runtime, the directory will be mounted, but uv will use the lock file
39+
# to ensure consistent dependencies
40+
COPY pyproject.toml uv.lock ./
41+
42+
# Install tox and tox-uv as system packages so they're available globally
43+
# This matches the original behavior where tox was installed via pip
44+
# We use uv pip install to install packages from the tox dependency group in pyproject.toml
45+
# by reading from the lock file which ensures consistent versions
46+
# Reinstall uv after pip install to ensure correct version (uv pip install may install a different version)
47+
# Clean up dependency files after installation to reduce image size
3448
RUN set -x \
35-
&& pip3 install uv==${PYTHON_UV_VERSION} tox==${PYTHON_TOX_VERSION} tox-uv==${PYTHON_TOX_UV_VERSION}\
49+
&& uv pip install --system --group tox \
50+
&& pip install --no-cache-dir --force-reinstall "uv==${UV_VERSION}" \
51+
&& rm -f pyproject.toml uv.lock \
3652
&& true
3753

3854
COPY .docker/entrypoint.sh /entrypoint.sh
39-
WORKDIR /data
4055

4156
LABEL image_name="GoodData Python SDK test image with python, tox and make"
4257
# LABEL maintainer="TigerTeam <tiger@gooddata.com>"

0 commit comments

Comments
 (0)