yaptide / ui

Yet Another Particle Transport IDE - frontend
https://yaptide.github.io/web_dev/
GNU General Public License v3.0
9 stars 4 forks source link

Install converter with poetry #1534

Closed hendzeld closed 3 months ago

hendzeld commented 3 months ago

Related to PR in converter module: https://github.com/yaptide/converter/pull/191

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

hendzeld commented 3 months ago

Gitpod: obraz

grzanka commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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: https://github.com/yaptide/ui/blob/c99384db45c5a8392f6237d9f8d4b839fbb4a9b3/Dockerfile#L20

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

hendzeld commented 3 months ago

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.

hendzeld commented 3 months ago

@grzanka Should work now.

I tested the image locally and it works.

grzanka commented 3 months ago

@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 commented 3 months ago

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