Skip to content

Commit df698e2

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

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
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: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,52 @@ 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 \
15-
&& apt-get install -y --no-install-recommends make curl gnupg \
16-
&& curl -sSLo /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
17-
&& curl -sSLo /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
19+
&& apt-get install -y --no-install-recommends make gnupg wget \
20+
&& pip install --no-cache-dir "uv==${UV_VERSION}" \
21+
&& wget -qO /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
22+
&& wget -qO /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
1823
&& export GNUPGHOME="$(mktemp -d)" \
1924
&& gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
2025
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
2126
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
2227
&& chmod +x /usr/local/bin/gosu \
2328
&& gosu nobody true \
24-
&& apt-get -y remove curl gnupg \
29+
&& apt-get -y remove gnupg \
2530
&& apt-get -y auto-remove \
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)
3447
RUN set -x \
35-
&& pip3 install uv==${PYTHON_UV_VERSION} tox==${PYTHON_TOX_VERSION} tox-uv==${PYTHON_TOX_UV_VERSION}\
48+
&& uv pip install --system --group tox \
49+
&& pip install --no-cache-dir --force-reinstall "uv==${UV_VERSION}" \
3650
&& true
3751

3852
COPY .docker/entrypoint.sh /entrypoint.sh
39-
WORKDIR /data
4053

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

0 commit comments

Comments
 (0)