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

Fix dev/Dockerfile + Add uv pip install for faster build time #997

Merged
merged 2 commits into from
May 29, 2024

Conversation

dwreeves
Copy link
Collaborator

Fix dev Dockerfile

The Dockerfile was not building because dbt-postgres==1.8.0 pinned psycopg2.

To resolve this, you need to apt-get install build-essential and libpq-dev. I added a RUN directive that does that. This is placed near the top as it makes the most sense for layering purposes.

Add uv

While I was at it, I added uv: https://github.com/astral-sh/uv tldr: this makes the Dockerfile build a little faster. This speed is especially important due to how the Dockerfile will typically be used: if a user makes a change to the cosmos/ directory and then wants to test their code, due to how the layers are stacked, the pip install will need to be re-run and resolved on over 100 Python packages on each code change.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 27, 2024
Copy link

netlify bot commented May 27, 2024

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit d5b3526
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/6656ee451e5f0500085773d0

@dosubot dosubot bot added area:dependencies Related to dependencies, like Python packages, library versions, etc area:performance Related to performance, like memory usage, CPU usage, speed, etc execution:docker Related to Docker execution environment labels May 27, 2024
Copy link
Collaborator

@tatiana tatiana left a comment

Choose a reason for hiding this comment

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

Thanks, @dwreeves , this is very handy for local development!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 29, 2024
@tatiana tatiana merged commit bfca374 into astronomer:main May 29, 2024
60 checks passed
tatiana pushed a commit that referenced this pull request Jun 6, 2024
## Fix dev Dockerfile

The Dockerfile was not building because `dbt-postgres==1.8.0` pinned
`psycopg2`.

To resolve this, you need to apt-get install `build-essential` and
`libpq-dev`. I added a `RUN` directive that does that. This is placed
near the top as it makes the most sense for layering purposes.

## Add uv

While I was at it, I added uv: https://github.com/astral-sh/uv tldr:
this makes the Dockerfile build a little faster. This speed is
especially important due to how the Dockerfile will typically be used:
if a user makes a change to the `cosmos/` directory and then wants to
test their code, due to how the layers are stacked, the pip install will
need to be re-run and resolved on over 100 Python packages on each code
change.
@tatiana tatiana mentioned this pull request Jun 6, 2024
tatiana added a commit that referenced this pull request Jun 6, 2024
Bug fixes

* Fix the invocation mode for ``ExecutionMode.VIRTUALENV`` by @marco9663
in #1023
* Fix Cosmos ``enable_cache`` setting by @tatiana in #1025
* Make ``GoogleCloudServiceAccountDictProfileMapping`` dataset profile
arg optional by @oliverrmaa and @pankajastro in #839 and #1017
* Athena profile mapping set ``aws_session_token`` in profile only if it
exists by @pankajastro in #1022

Others

* Update dbt and Airflow conflicts matrix by @tatiana in #1026
* Enable Python 3.12 unittest by @pankajastro in #1018
* Improve error logging in ``DbtLocalBaseOperator`` by @davidsteinar in
#1004
* Add GitHub issue templates for bug reports and feature request by
@pankajkoti in #1009
* Add more fields in bug template to reduce turnaround in issue triaging
by @pankajkoti in #1027
* Fix ``dev/Dockerfile`` + Add ``uv pip install`` for faster build time
by @dwreeves in #997
* Drop support for Airflow 2.3 by @pankajkoti in #994
* Update Astro Runtime image by @RNHTTR in #988 and #989
* Enable ruff F linting by @pankajastro in #985
* Move Cosmos Airflow configuration to settings.py by @pankajastro in
#975
* Fix CI Issues by @tatiana in #1005
* Pre-commit hook updates in #1000, #1019

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Reeves <[email protected]>
Co-authored-by: Pankaj Koti <[email protected]>
Co-authored-by: davidsteinar <[email protected]>
Co-authored-by: David Steinar Asgrimsson <[email protected]>
Co-authored-by: Marco Yuen <[email protected]>
Co-authored-by: Pankaj Singh <[email protected]>
Co-authored-by: Ollie Ma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dependencies Related to dependencies, like Python packages, library versions, etc area:performance Related to performance, like memory usage, CPU usage, speed, etc execution:docker Related to Docker execution environment lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants