scanoss / scanoss.py

The SCANOSS python package providing a simple, easy to consume library for interacting with SCANOSS APIs/Engine.
MIT License
27 stars 19 forks source link

Fatal error in Dockerfile from missing dist directory #48

Closed lucasgonze closed 1 month ago

lucasgonze commented 2 months ago

I'm running docker on commit 8c0bbf6582544465c1f77973a9724c41cd191624. It produces the following error.

 => ERROR [builder  4/11] COPY ./dist/scanoss-*-py3-none-any.whl /install/                             0.0s
------
 > [builder  4/11] COPY ./dist/scanoss-*-py3-none-any.whl /install/:
------
Dockerfile:20
--------------------
  18 |     ENV PATH=/root/.local/bin:$PATH
  19 |     
  20 | >>> COPY ./dist/scanoss-*-py3-none-any.whl /install/
  21 |     
  22 |     # Install dependencies
--------------------
ERROR: failed to solve: lstat /var/lib/docker/tmp/buildkit-mount2678275625/dist: no such file or directory

The error appeared in commit fcd7c8ee8803d079323a5b5e0e7529ceb760cf25

ortizjeronimo commented 2 months ago

Hello @lucasgonze

Are you still having this issue?

lucasgonze commented 2 months ago

Hello @lucasgonze

Are you still having this issue?

No change using today's Dockerfile, commit 8bc987caffbfc603af1643fa99ad08cbf10e7c81

The last working commit was 7c2b76348bd67832270c400ef2ebb317adf05065

The issue appeared in fcd7c8ee8803d079323a5b5e0e7529ceb760cf25

There is clearly a file in the local filesystem during docker build named ./dist/scanoss-*-py3-none-any.whl. "dist" is typically for built artifacts. After exploring the internet to find such a file I found it in github.com/scanoss/webhook:

## Building
Python 3 is required. It uses setuptools to build a PIP wheel.
- Install dependencies: `make init && make init-dev`
- Generate a new wheel: `make dist`. The binaries will be located under `dist`.

Could it be that there is an assumption in your team of having done certain preparation steps, and the general public doesn't know what those steps are?

On investigation, the assumption is that the user running docker build has previously done make dist.

eeisegn commented 1 month ago

Hi @lucasgonze,

Thank you for raising this gap!

The current iteration of this Dockerfile relies on the artifact being built as a pre-requisite. We do not currently have a multi-stage container file build. If you look at the Makefile, you will see make ghcr_build depends on dist.

The current container release workflow makes sure to build the distribution before building the container. We do this as the package is pure Python and therefore does not need to be re-built when we do a multi-arch release.

If you would still like a multi-stage container workflow to simplify local build, please raise an enhancement request and we'll happily look into it. Or alternatively, feel free to submit a PR also :-)

Regards, SCANOSS.

lucasgonze commented 1 month ago

@eeisegn , thanks. Like a lot of bugs that turn out to be features, this was about taking code intended for one context and cannibalizing it for another context. The assumption of running a pre-requisite is completely reasonable in the original context of the Makefile.

I may come back to the multi-stage build.