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

Install converter with poetry #1534

Merged
merged 7 commits into from
Mar 15, 2024
Merged

Install converter with poetry #1534

merged 7 commits into from
Mar 15, 2024

Conversation

hendzeld
Copy link
Contributor

@hendzeld hendzeld commented Mar 13, 2024

Related to PR in converter module: yaptide/converter#191

The mentioned PR should be resolved and merged before merging this one.
Then, the git submodule in this MR should be updated.

@hendzeld
Copy link
Contributor Author

Gitpod:
obraz

@hendzeld hendzeld marked this pull request as ready for review March 13, 2024 17:06
@hendzeld hendzeld requested a review from grzanka March 13, 2024 17:06
@grzanka
Copy link
Contributor

grzanka commented Mar 13, 2024

I get an error when running docker:

grzanka@grzankax1:~/workspace/ui$ docker compose up --build --detach
[+] Building 1.8s (22/31)                                                                                                                                               docker:default
 => [yaptide_ui internal] load build definition from Dockerfile                                                                                                                   0.0s
 => => transferring dockerfile: 3.04kB                                                                                                                                            0.0s
 => [yaptide_ui internal] load metadata for docker.io/library/nginx:alpine                                                                                                        0.8s
 => [yaptide_ui internal] load metadata for docker.io/library/python:3.11                                                                                                         0.7s
 => [yaptide_ui internal] load metadata for docker.io/library/node:18                                                                                                             0.7s
 => [yaptide_ui internal] load metadata for docker.io/library/alpine:latest                                                                                                       0.8s
 => [yaptide_ui internal] load .dockerignore                                                                                                                                      0.0s
 => => transferring context: 66B                                                                                                                                                  0.0s
 => [yaptide_ui stage-3 1/5] FROM docker.io/library/nginx:alpine@sha256:6a2f8b28e45c4adea04ec207a251fd4a2df03ddc930f782af51e315ebc76e9a9                                          0.0s
 => [yaptide_ui build  1/11] FROM docker.io/library/node:18@sha256:b39895225fb1984139d5af76400aff8fac3dd5bc00dd41a3ce22fc8a6cf538d5                                               0.0s
 => [yaptide_ui cert-gen 1/4] FROM docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                        0.0s
 => [yaptide_ui wheel-builder 1/4] FROM docker.io/library/python:3.11@sha256:47d0618fb878d93e1b8cacb184fd8f727ae95c1b85d5959723e1d3e1848e2aba                                     0.0s
 => [yaptide_ui internal] load build context                                                                                                                                      0.4s
 => => transferring context: 2.53MB                                                                                                                                               0.4s
 => CACHED [yaptide_ui stage-3 2/5] RUN rm /etc/nginx/conf.d/default.conf                                                                                                         0.0s
 => CACHED [yaptide_ui cert-gen 2/4] RUN apk add --no-cache openssl                                                                                                               0.0s
 => CACHED [yaptide_ui cert-gen 3/4] WORKDIR /certs                                                                                                                               0.0s
 => CACHED [yaptide_ui cert-gen 4/4] RUN openssl req -new -newkey rsa:2048 -days 365 -nodes -x509     -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"     -keyout serv  0.0s
 => CACHED [yaptide_ui stage-3 3/5] COPY --from=cert-gen /certs /etc/nginx/conf.d                                                                                                 0.0s
 => CACHED [yaptide_ui wheel-builder 2/4] RUN pip install --no-cache-dir build wheel setuptools                                                                                   0.0s
 => CACHED [yaptide_ui wheel-builder 3/4] COPY src/libs/converter/ .                                                                                                              0.0s
 => CACHED [yaptide_ui build  2/11] WORKDIR /usr/src/app                                                                                                                          0.0s
 => CACHED [yaptide_ui build  3/11] COPY package.json package-lock.json ./                                                                                                        0.0s
 => ERROR [yaptide_ui wheel-builder 4/4] RUN python -m build --wheel --no-isolation                                                                                               0.4s
 => CANCELED [yaptide_ui build  4/11] RUN npm ci                                                                                                                                  0.6s
------                                                                                                                                                                                 
 > [yaptide_ui wheel-builder 4/4] RUN python -m build --wheel --no-isolation:
0.357 * Getting build dependencies for wheel...
0.387 
0.387 Traceback (most recent call last):
0.387   File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_impl.py", line 321, in _call_hook
0.387     raise BackendUnavailable(data.get('traceback', ''))
0.387 pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
0.387   File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
0.387     obj = import_module(mod_path)
0.387           ^^^^^^^^^^^^^^^^^^^^^^^
0.387   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
0.387     return _bootstrap._gcd_import(name[level:], package, level)
0.387            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.387   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.387   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.387   File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
0.387   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
0.387   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.387   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.387   File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
0.387   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
0.387   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.387   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.387   File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
0.387   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
0.387   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.387   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.387   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
0.387 ModuleNotFoundError: No module named 'poetry'
0.387 
0.387 ERROR Backend 'poetry.core.masonry.api' is not available.
------
failed to solve: process "/bin/sh -c python -m build --wheel --no-isolation" did not complete successfully: exit code: 1

@hendzeld
Copy link
Contributor Author

hendzeld commented Mar 13, 2024

I get an error when running docker:

I will fix it, I forgot to check this.
This is somehow strange, that we are building packages differently in Docker.
If possible, it will be best to use npm run scripts.

@grzanka
Copy link
Contributor

grzanka commented Mar 13, 2024

I will fix it, I forgot to check this. This is somehow strange, that we are building packages differently in Docker. If possible, it will be best to use npm run scripts.

That was by purpose, but indeed deserves a comment somewhere. By getting rid of python in nodejs docker image I get much faster build and smaller size of docker images.

Buiilding of converter wheel is extracted to a separate stage which runs on pure-python docker:

ui/Dockerfile

Line 20 in c99384d

# Stage 2: Build the wheel package for the converter part of the UI.

Then this wheel is copied to another layer where its integrated into a nodejs artifact on pure-node image.

@hendzeld
Copy link
Contributor Author

That was by purpose, but indeed deserves a comment somewhere. By getting rid of python in nodejs docker image I get much faster build and smaller size of docker images.

Ok, that make sense :)

I will update this later and verify if it works properly then.

Poetry generates wheel and tg.zip archive otherwise
@hendzeld
Copy link
Contributor Author

@grzanka Should work now.

I tested the image locally and it works.

@grzanka
Copy link
Contributor

grzanka commented Mar 15, 2024

@grzanka Should work now.

I tested the image locally and it works.

Yes, it works now. I've merged the PR on the converter repo. Can you adjust this PR, to the link to converter submodule points to a master on converter repo ?

@hendzeld
Copy link
Contributor Author

Yes, it works now. I've merged the PR on the converter repo. Can you adjust this PR, to the link to converter submodule points to a master on converter repo ?

@grzanka Done

@grzanka grzanka added this pull request to the merge queue Mar 15, 2024
Merged via the queue into master with commit 3fa31cd Mar 15, 2024
10 checks passed
@grzanka grzanka deleted the install-converter-with-poetry branch March 15, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants