Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
FROM python:3.11
FROM python:3.14
RUN useradd --user-group bagit-tester
RUN install -d -o bagit-tester /bagit
USER bagit-tester
WORKDIR /bagit
COPY pyproject.toml /bagit/pyproject.toml
COPY .git/ /bagit/.git/
COPY *.rst *.py /bagit/
COPY *.rst /bagit/
COPY src/ /bagit/src/
COPY test.py /bagit/
COPY test-data /bagit/test-data/
CMD [ "python", "setup.py", "test" ]
COPY utils/ /bagit/
RUN pip install --upgrade pip && pip install uv && uv sync --all-extras

Check warning on line 12 in Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this RUN instruction with the consecutive ones.

See more on https://sonarcloud.io/project/issues?id=LibraryOfCongress_bagit-python&issues=AZ1lRRE90jMYmy4UkMLE&open=AZ1lRRE90jMYmy4UkMLE&pullRequest=204

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would improve caching and also has the ever popular version pin:

Suggested change
RUN pip install --upgrade pip && pip install uv && uv sync --all-extras
COPY --from=ghcr.io/astral-sh/uv:0.11.5-python3.14-trixie /uv /uvx /usr/bin/
ENV UV_LINK_MODE=copy
RUN --mount=type=cache,target=/root/.cache/uv uv sync --all-extras

(at this point, however, it'd also be reasonable ask whether the base image should simply be FROM ghcr.io/astral-sh/uv:0.11.5-python3.14-trixie)

If we wanted to stay with pip—which has a certain appeal for avoiding various political debates in the community—I would do this:

Suggested change
RUN pip install --upgrade pip && pip install uv && uv sync --all-extras
RUN pip install ---upgrade --uploaded-prior-to=$(date -Iseconds --date="1 week ago") pip

RUN mkdir /home/bagit-tester/ && mkdir /home/bagit-tester/.cache && mkdir /home/bagit-tester/.cache/uv
RUN chown bagit-tester /home/bagit-tester/.cache/uv
USER bagit-tester
CMD [ "uv", "run", "pytest" ]