Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uv for our Dockerfile #40

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

ethanholz
Copy link
Contributor

@ethanholz ethanholz commented Nov 8, 2024

This pull request includes changes to the Dockerfile to improve the setup and execution of the application. The most important changes include switching to using uv for dependency management and modifying the way the application is copied and installed.

Improvements to Dockerfile setup:

  • Added COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ to include uv in the image.
  • Replaced RUN mkdir app and COPY . /app with ADD . /app to simplify the copying process.
  • Changed RUN pip install --no-cache-dir /app to RUN uv sync --frozen to use uv for installing dependencies.

Improvements to application execution:

  • Updated the CMD from ["python", "/app/src/gha_runner/"] to ["uv", "run", "-m", "gha_runner"] to run the application using uv.

By default, the pip command remains accessible, but incorporating the uv.lock ensures repeatability, particularly since the container is constructed with each execution of the action (for the time being). This has been verified locally through the creation of a Docker image on my personal computer. However, I intend to merge this change to facilitate testing. If the implementation proves unsuccessful, reverting this commit is acceptable.

Should the implementation be successful, we can develop documentation outlining the modifications required to maintain the lockfile in sync with new releases.

This changes the project to adopting [uv](https://docs.astral.sh/uv/)
for dependency resolution. At this time, we support none of the
additional uv features other than the lockfile and then using it to
install and run the application. Using pip still works as well!
@ethanholz ethanholz self-assigned this Nov 8, 2024
@ethanholz ethanholz requested a review from dwhswenson November 8, 2024 18:33
@ethanholz ethanholz added the enhancement New feature or request label Nov 8, 2024
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.73%. Comparing base (8c1b869) to head (57b7c20).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #40   +/-   ##
=======================================
  Coverage   94.73%   94.73%           
=======================================
  Files           3        3           
  Lines         304      304           
=======================================
  Hits          288      288           
  Misses         16       16           
Flag Coverage Δ
unittests 94.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dwhswenson dwhswenson left a comment

Choose a reason for hiding this comment

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

Treating this as a trial run, so this works for me. We can use this as a trial to see how uv works for us.

@dwhswenson dwhswenson merged commit 206bc37 into omsf-eco-infra:main Nov 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants