plgd-dev/hub

How to build plgd-hub and bundle

Askidea opened this issue · 2 comments

@jkralik

In the previous version, plgd-dev/cloud (v2?), I built bundle like this:
~/go/src/github.com/plgd-dev/cloud$ make cloud-build
~/go/src/github.com/plgd-dev/cloud/bundle$ make build

In plgd-dev/hub (commit fb56f98), I ran it as follows, but it did not work well. I can't find documentation on how to build it.
How do I build hub or bundle?

ubuntu20:~/go/src/github.com/plgd-dev/hub$ make build
make -C bundle build LATEST_TAG=vnext
make[1]: Entering directory '/home/ocfcloud/go/src/github.com/plgd-dev/hub/bundle'
make -C ../http-gateway build-www
make[2]: Entering directory '/home/ocfcloud/go/src/github.com/plgd-dev/hub/http-gateway'
cd .. && mkdir -p /home/ocfcloud/go/src/github.com/plgd-dev/hub/http-gateway/web/build && DOCKER_BUILDKIT=1 docker build \
        --network=host \
        --tag plgd/http-gateway-ui:vnext-fb56f98 \
        --tag plgd/http-gateway-ui:vnext \
        --tag plgd/http-gateway-ui:main \
        -f http-gateway/Dockerfile.www \
        .
[+] Building 34.9s (9/9) FINISHED                                                                                         docker:default
 => [internal] load build definition from Dockerfile.www                                                                            0.0s
 => => transferring dockerfile: 393B                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                   0.0s
 => => transferring context: 229B                                                                                                   0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                                          1.2s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021     0.0s
 => [internal] load metadata for docker.io/library/node:16                                                                          0.8s
 => [internal] load build context                                                                                                   0.0s
 => => transferring context: 27.12kB                                                                                                0.0s
 => CACHED [1/3] FROM docker.io/library/node:16@sha256:f77a1aef2da8d83e45ec990f45df50f1a286c5fe8bbfb8c6e4246c6389705c0b             0.0s
 => [2/3] COPY http-gateway/web /web                                                                                                0.0s
 => ERROR [3/3] RUN cd /web &&     npm config set fetch-retries 3 &&     npm config set fetch-retry-mintimeout 600000 &&      npm  32.6s
------
 > [3/3] RUN cd /web &&     npm config set fetch-retries 3 &&     npm config set fetch-retry-mintimeout 600000 &&      npm config set fetch-retry-maxtimeout 1200000 &&     npm config set fetch-timeout 1800000 &&     npm install --ignore-scripts &&     npm run build:
24.30
24.30 added 1849 packages, and audited 1852 packages in 23s
24.30
24.30 249 packages are looking for funding
24.30   run `npm fund` for details
24.32
24.32 24 vulnerabilities (8 moderate, 10 high, 6 critical)
24.32
24.32 To address issues that do not require attention, run:
24.32   npm audit fix
24.32
24.32 To address all issues possible (including breaking changes), run:
24.32   npm audit fix --force
24.32
24.32 Some issues need review, and may require choosing
24.32 a different dependency.
24.32
24.32 Run `npm audit` for details.
24.55
24.55 > plgd-dashboard@1.0.0 build
24.55 > npm run generate-language-files && craco build
24.55
24.75
24.75 > plgd-dashboard@1.0.0 generate-language-files
24.75 > node ./scripts/generate-language-files.js
24.75
25.37 > [react-intl-po] write file -> ./src/languages/languages.json ✔️
25.37
25.37 (node:124) [DEP0128] DeprecationWarning: Invalid 'main' field in '/web/node_modules/po2json/package.json' of './lib/po2json'. Please either fix that or report it to the module author
25.37 (Use `node --trace-deprecation ...` to show where the warning was created)
27.23 Creating an optimized production build...
27.35 Browserslist: caniuse-lite is outdated. Please run:
27.35   npx update-browserslist-db@latest
27.35   Why you should do it regularly: https://github.com/browserslist/update-db#readme
32.32 Failed to compile.
32.32
32.32 Error: [BABEL] /web/src/index.tsx: Cannot find module '@babel/plugin-proposal-private-property-in-object'
32.32 Require stack:
32.32 - /web/node_modules/babel-preset-react-app/create.js
32.32 - /web/node_modules/babel-preset-react-app/index.js
32.32 - /web/node_modules/@babel/core/lib/config/files/module-types.js
32.32 - /web/node_modules/@babel/core/lib/config/files/configuration.js
32.32 - /web/node_modules/@babel/core/lib/config/files/index.js
32.32 - /web/node_modules/@babel/core/lib/index.js
32.32 - /web/node_modules/@rollup/plugin-babel/dist/index.js
32.32 - /web/node_modules/workbox-build/build/lib/bundle.js
32.32 - /web/node_modules/workbox-webpack-plugin/build/generate-sw.js
32.32 - /web/node_modules/workbox-webpack-plugin/build/index.js
32.32 - /web/node_modules/react-scripts/config/webpack.config.js
32.32 - /web/node_modules/@craco/craco/dist/lib/cra.js
32.32 - /web/node_modules/@craco/craco/dist/scripts/build.js (While processing: "/web/node_modules/babel-preset-react-app/index.js")
32.32     at Generator.next (<anonymous>)
32.32     at Generator.next (<anonymous>)
32.32     at Generator.next (<anonymous>)
32.32     at Generator.next (<anonymous>)
32.32     at cachedFunction.next (<anonymous>)
32.32     at loadPresetDescriptor.next (<anonymous>)
32.32     at recursePresetDescriptors.next (<anonymous>)
32.32     at Generator.next (<anonymous>)
32.32     at loadFullConfig.next (<anonymous>)
32.32     at transform.next (<anonymous>)
32.32     at new Promise (<anonymous>)
32.32     at Generator.next (<anonymous>)
32.32     at new Promise (<anonymous>)
32.32
32.32
------
Dockerfile.www:4
--------------------
   3 |     COPY http-gateway/web /web
   4 | >>> RUN cd /web && \
   5 | >>>     npm config set fetch-retries 3 && \
   6 | >>>     npm config set fetch-retry-mintimeout 600000 &&  \
   7 | >>>     npm config set fetch-retry-maxtimeout 1200000 && \
   8 | >>>     npm config set fetch-timeout 1800000 && \
   9 | >>>     npm install --ignore-scripts && \
  10 | >>>     npm run build
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /web &&     npm config set fetch-retries 3 &&     npm config set fetch-retry-mintimeout 600000 &&      npm config set fetch-retry-maxtimeout 1200000 &&     npm config set fetch-timeout 1800000 &&     npm install --ignore-scripts &&     npm run build" did not complete successfully: exit code: 1
make[2]: *** [Makefile:33: build-www] Error 1
make[2]: Leaving directory '/home/ocfcloud/go/src/github.com/plgd-dev/hub/http-gateway'
make[1]: *** [Makefile:34: build-servicecontainer] Error 2
make[1]: Leaving directory '/home/ocfcloud/go/src/github.com/plgd-dev/hub/bundle'
make: *** [Makefile:330: bundle] Error 2

@Askidea Did you download also submodules?

cd ~/go/src/github.com/plgd-dev/hub
git submodule update --init
make build

@jkralik I followed your instructions and the build was successful.