Skip to content

Commit

Permalink
feat(docker): Updated Dependency Manager for kedro-docker to uv (#…
Browse files Browse the repository at this point in the history
…929)

* updated Dockerfile to use uv for dep management

Signed-off-by: Minura Punchihewa <[email protected]>

* updated Spark Dockerfile to use uv for dep management

Signed-off-by: Minura Punchihewa <[email protected]>

* added the --system flag to allow installation across the system

Signed-off-by: Minura Punchihewa <[email protected]>

* updated the release doc

Signed-off-by: Minura Punchihewa <[email protected]>

---------

Signed-off-by: Minura Punchihewa <[email protected]>
  • Loading branch information
MinuraPunchihewa authored Nov 12, 2024
1 parent d4fd7da commit 78bc252
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions kedro-docker/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Upcoming Release
* Switch dependency management to `uv`.

## Thanks for supporting contributions
[Minura Punchihewa](https://github.com/MinuraPunchihewa)

# Release 0.7.0
## Major features and improvements
Expand Down
9 changes: 6 additions & 3 deletions kedro-docker/kedro_docker/template/Dockerfile.simple
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
ARG BASE_IMAGE=python:3.9-slim
FROM $BASE_IMAGE as runtime-environment

# update pip and install uv
RUN python -m pip install -U "pip>=21.2"
RUN pip install uv

# install project requirements
COPY requirements.txt /tmp/requirements.txt
RUN python -m pip install -U "pip>=21.2"
RUN pip install --no-cache-dir -r /tmp/requirements.txt && rm -f /tmp/requirements.txt
RUN uv pip install --system --no-cache-dir -r /tmp/requirements.txt && rm -f /tmp/requirements.txt

# add kedro user
ARG KEDRO_UID=999
ARG KEDRO_GID=0
RUN groupadd -f -g ${KEDRO_GID} kedro_group && \
useradd -m -d /home/kedro_docker -s /bin/bash -g ${KEDRO_GID} -u ${KEDRO_UID} kedro_docker
useradd -m -d /home/kedro_docker -s /bin/bash -g ${KEDRO_GID} -u ${KEDRO_UID} kedro_docker

WORKDIR /home/kedro_docker
USER kedro_docker
Expand Down
11 changes: 7 additions & 4 deletions kedro-docker/kedro_docker/template/Dockerfile.spark
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ FROM $BASE_IMAGE as runtime-environment

# install JVM
RUN apt-get update && mkdir -p /usr/share/man/man1 && \
apt-get install -y procps default-jre-headless && rm -rf /var/lib/apt/lists/*
apt-get install -y procps default-jre-headless && rm -rf /var/lib/apt/lists/*

# update pip and install uv
RUN python -m pip install -U "pip>=21.2"
RUN pip install uv

# install project requirements
COPY requirements.txt /tmp/requirements.txt
RUN python -m pip install -U "pip>=21.2"
RUN pip install --no-cache-dir -r /tmp/requirements.txt && rm -f /tmp/requirements.txt
RUN uv pip install --system --no-cache-dir -r /tmp/requirements.txt && rm -f /tmp/requirements.txt

# add kedro user
ARG KEDRO_UID=999
ARG KEDRO_GID=0
RUN groupadd -f -g ${KEDRO_GID} kedro_group && \
useradd -m -d /home/kedro_docker -s /bin/bash -g ${KEDRO_GID} -u ${KEDRO_UID} kedro_docker
useradd -m -d /home/kedro_docker -s /bin/bash -g ${KEDRO_GID} -u ${KEDRO_UID} kedro_docker

WORKDIR /home/kedro_docker
USER kedro_docker
Expand Down

0 comments on commit 78bc252

Please sign in to comment.