Skip to content

Fixes Dockerfile to use uv#204

Open
matthewdeanmartin wants to merge 3 commits intoLibraryOfCongress:masterfrom
matthewdeanmartin:fix/broken-dockerfile
Open

Fixes Dockerfile to use uv#204
matthewdeanmartin wants to merge 3 commits intoLibraryOfCongress:masterfrom
matthewdeanmartin:fix/broken-dockerfile

Conversation

@matthewdeanmartin
Copy link
Copy Markdown
Contributor

Dockerfile had setup.py syntax. Now matches readme.rst

This now works as promised
docker build -t bagit:latest . && docker run -it bagit:latest

Dockerfile Outdated
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
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

@matthewdeanmartin
Copy link
Copy Markdown
Contributor Author

It was easier to get it to work with astral-sh/uv:0.11.5-python3.14-trixie

Also added dos2linux because git corrupts the line feeds. I figure if someone is running on linux they probably are running their tests on bare metal, it's the windows people that needs the docker file.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 8, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants