Skip to content

replace poetry with uv within api component of prowler #10776

@AOrps

Description

@AOrps

Feature search

  • I have searched the existing issues and this feature has not been requested yet or is already in our Public Roadmap

Which component would this feature affect?

Prowler API

Related to specific cloud provider?

No response

New feature motivation

I'm frustrated when a Dockerfile take a while to build. I want to Dockerfile to be built faster

Solution Proposed

replace poetry with uv on api component

Use case and benefits

This would help security teams because they can shave off time and compute resources when building Docker images.

Describe alternatives you've considered

not switching to poetry and just suffering for over 40 seconds when it is installing things with poetry

Additional context

poetry

=> [internal] load metadata for [docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec182](http://docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec182)  2.1s
 => [auth] library/python:pull token for [registry-1.docker.io](http://registry-1.docker.io/)                                                         0.0s
 => [internal] load .dockerignore                                                                                     0.0s
 => => transferring context: 2B                                                                                       0.0s
 => [internal] load build context                                                                                     0.1s
 => => transferring context: 7.96MB                                                                                   0.1s
 => [build  1/14] FROM [docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a42](http://docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a42)  3.3s
 => => resolve [docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b](http://docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b)  0.0s
 => => sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db 9.13kB / 9.13kB                        0.0s
 => => sha256:97983fa8cc88343512862c62307159a82261c3528dc025f79e5a3f7af43e50b4 1.75kB / 1.75kB                        0.0s
 => => sha256:acf8897bf01a3a0ea273a50a58fc10b6317a3e360bd29aa7c9246a54d7c63e88 5.57kB / 5.57kB                        0.0s
 => => sha256:61320b01ae5e0798393ef25f2dc72faf43703e60ba089b07d7170acbabbf8f62 28.23MB / 28.23MB                      1.4s
 => => sha256:be1274d3cce09d8126f8176203ba1e91f6733a713c1185ba01ee704759b0b62d 3.51MB / 3.51MB                        0.8s
 => => sha256:8991c9200d621283b06ae395129d454c998e0f55095e106055240b5956ab2a2a 13.66MB / 13.66MB                      0.8s
 => => sha256:7a1cb8b882211b870d7e639e775f91e423a526092b4b3eadefbab6aa7457910d 249B / 249B                            1.1s
 => => extracting sha256:61320b01ae5e0798393ef25f2dc72faf43703e60ba089b07d7170acbabbf8f62                             1.1s
 => => extracting sha256:be1274d3cce09d8126f8176203ba1e91f6733a713c1185ba01ee704759b0b62d                             0.1s
 => => extracting sha256:8991c9200d621283b06ae395129d454c998e0f55095e106055240b5956ab2a2a                             0.5s
 => => extracting sha256:7a1cb8b882211b870d7e639e775f91e423a526092b4b3eadefbab6aa7457910d                             0.0s
 => [build  2/14] RUN apt-get update && apt-get install -y --no-install-recommends     wget     libicu72     gcc     25.5s
 => [build  3/14] RUN ARCH=$(uname -m) &&     if [ "$ARCH" = "x86_64" ]; then         wget --progress=dot:giga https  4.7s 
 => [build  4/14] RUN ARCH=$(uname -m) &&     if [ "$ARCH" = "x86_64" ]; then         TRIVY_ARCH="Linux-64bit" ;      3.0s 
 => [build  5/14] RUN addgroup --gid 1000 prowler &&     adduser --uid 1000 --gid 1000 --disabled-password --gecos "  0.6s 
 => [build  6/14] WORKDIR /home/prowler                                                                               0.0s 
 => [build  7/14] RUN mkdir -p /tmp/prowler_api_output                                                                0.5s 
 => [build  8/14] COPY pyproject.toml ./                                                                              0.0s 
 => [build  9/14] RUN pip install --no-cache-dir --upgrade pip &&     pip install --no-cache-dir poetry==2.3.4       14.2s 
 => [build 10/14] RUN poetry install --no-root &&     rm -rf ~/.cache/pip                                           207.8s 
 => [build 11/14] RUN poetry run python "$(poetry env info --path)/src/prowler/prowler/providers/m365/lib/powershel  25.9s 
 => [build 12/14] COPY src/backend/ ./backend/                                                                        0.1s 
 => [build 13/14] COPY [docker-entrypoint.sh](http://docker-entrypoint.sh/) ./[docker-entrypoint.sh](http://docker-entrypoint.sh/)                                                    0.0s 
 => [build 14/14] WORKDIR /home/prowler/backend                                                                       0.0s 
 => exporting to image                                                                                               16.0s 
 => => exporting layers                                                                                              16.0s
 => => writing image sha256:285391e6cda6ddcbfa35c15c9be8e3bfbe8d554ad4d29cdc4bee24f600fdfa66                          0.0s
 => => naming to [docker.io/prowlercloud/prowler-api:latest](http://docker.io/prowlercloud/prowler-api:latest)                                                            0.0

uv

$ docker build --no-cache -t prowlercloud/prowler-api:latest-with-uv .
[+] Building 113.6s (19/19) FINISHED                                                                        docker:default
 => [internal] load build definition from Dockerfile                                                                  0.0s
 => => transferring dockerfile: 3.24kB                                                                                0.0s
 => [internal] load metadata for [docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec182](http://docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec182)  0.0s
 => [internal] load .dockerignore                                                                                     0.0s
 => => transferring context: 2B                                                                                       0.0s
 => [internal] load build context                                                                                     0.0s
 => => transferring context: 18.33kB                                                                                  0.0s
 => CACHED [build  1/14] FROM [docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828ed](http://docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828ed)  0.0s
 => [build  2/14] RUN apt-get update && apt-get install -y --no-install-recommends     wget     git     libicu72     31.6s
 => [build  3/14] RUN ARCH=$(uname -m) &&     if [ "$ARCH" = "x86_64" ]; then         wget --progress=dot:giga https  4.5s 
 => [build  4/14] RUN ARCH=$(uname -m) &&     if [ "$ARCH" = "x86_64" ]; then         TRIVY_ARCH="Linux-64bit" ;      2.8s 
 => [build  5/14] RUN addgroup --gid 1000 prowler &&     adduser --uid 1000 --gid 1000 --disabled-password --gecos "  0.7s 
 => [build  6/14] WORKDIR /home/prowler                                                                               0.0s 
 => [build  7/14] RUN mkdir -p /tmp/prowler_api_output                                                                0.5s 
 => [build  8/14] COPY pyproject.toml uv.lock ./                                                                      0.0s 
 => [build  9/14] RUN pip install --no-cache-dir --upgrade pip &&     pip install --no-cache-dir uv==0.11.7           6.1s 
 => [build 10/14] RUN uv sync --no-install-project &&     rm -rf ~/.cache/uv                                         32.7s 
 => [build 11/14] RUN .venv/bin/python .venv/lib/python3.12/site-packages/prowler/providers/m365/lib/powershell/m36  23.8s 
 => [build 12/14] COPY src/backend/ ./backend/                                                                        0.1s 
 => [build 13/14] COPY [docker-entrypoint.sh](http://docker-entrypoint.sh/) ./[docker-entrypoint.sh](http://docker-entrypoint.sh/)                                                    0.0s 
 => [build 14/14] WORKDIR /home/prowler/backend                                                                       0.0s 
 => exporting to image                                                                                               10.7s 
 => => exporting layers                                                                                              10.7s 
 => => writing image sha256:e82e323c2738bc0b88706807038d6f0f90983df1e33dfe148e17d8963f39f3bc                          0.0s
 => => naming to [docker.io/prowlercloud/prowler-api:latest-with-uv](http://docker.io/prowlercloud/prowler-api:latest-with-uv)                                                    0.0s

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature request for Prowler.plannedIssues that are in Prowler Roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions