Docker Build is broken
TraderApophis opened this issue · 12 comments
Describe the issue
Building inside docker from a clone of the repo is broken. Error shown below.
...
Steps to reproduce
root@###:/# git clone https://github.com/Tucsky/aggr
Cloning into 'aggr'...
remote: Enumerating objects: 6980, done.
remote: Counting objects: 100% (924/924), done.
remote: Compressing objects: 100% (393/393), done.
remote: Total 6980 (delta 566), reused 797 (delta 524), pack-reused 6056
Receiving objects: 100% (6980/6980), 4.93 MiB | 13.21 MiB/s, done.
Resolving deltas: 100% (5380/5380), done.
root@###:/# cd aggr
root@###:/# docker build -t aggr-chart .
[+] Building 4.0s (13/16)
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 464B 0.0s
=> [internal] load metadata for docker.io/library/nginx:stable-alpine 0.8s
=> [internal] load metadata for docker.io/library/node:lts-alpine 0.8s
=> [internal] load build context 0.1s
=> => transferring context: 8.46MB 0.1s
=> CACHED [production-stage 1/4] FROM docker.io/library/nginx:stable-alpine@sha256:b7db705c8986070be8aa99ec0886886ddb3c75b1e46301f54865b16db79e9e52 0.0s
=> [build-stage 1/7] FROM docker.io/library/node:lts-alpine@sha256:1ccc70acda680aa4ba47f53e7c40b2d4d6892de74817128e0662d32647dd7f4d 0.0s
=> CACHED [build-stage 2/7] WORKDIR /app 0.0s
=> CACHED [build-stage 3/7] RUN apk --no-cache add git 0.0s
=> CACHED [build-stage 4/7] COPY package*.json ./ 0.0s
=> CACHED [build-stage 5/7] RUN npm install 0.0s
=> [build-stage 6/7] COPY . . 0.0s
=> ERROR [build-stage 7/7] RUN npm run build 3.1s
------
> [build-stage 7/7] RUN npm run build:
#0 0.450
#0 0.450 > aggr@3.3.2 build
#0 0.450 > vue-cli-service build
#0 0.450
#0 0.903
#0 0.904 - Building for production...
#0 2.049 Error: error:0308010C:digital envelope routines::unsupported
#0 2.049 at new Hash (node:internal/crypto/hash:71:19)
#0 2.049 at Object.createHash (node:crypto:133:10)
#0 2.049 at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
#0 2.049 at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
#0 2.049 at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
#0 2.049 at /app/node_modules/webpack/lib/NormalModule.js:503:5
#0 2.049 at /app/node_modules/webpack/lib/NormalModule.js:358:12
#0 2.049 at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
#0 2.049 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
#0 2.049 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
#0 2.049 at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
#0 2.049 at runSyncOrAsync (/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
#0 2.049 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
#0 2.049 at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
#0 2.049 at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
#0 2.049 at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
#0 3.063 /app/node_modules/loader-runner/lib/LoaderRunner.js:114
#0 3.063 throw e;
#0 3.063 ^
#0 3.063
#0 3.063 Error: error:0308010C:digital envelope routines::unsupported
#0 3.063 at new Hash (node:internal/crypto/hash:71:19)
#0 3.063 at Object.createHash (node:crypto:133:10)
#0 3.063 at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
#0 3.063 at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
#0 3.063 at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
#0 3.063 at /app/node_modules/webpack/lib/NormalModule.js:503:5
#0 3.063 at /app/node_modules/webpack/lib/NormalModule.js:358:12
#0 3.063 at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
#0 3.063 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
#0 3.063 at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
#0 3.063 at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
#0 3.063 at context.callback (/app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
#0 3.063 at /app/node_modules/cache-loader/dist/index.js:147:7
#0 3.063 at /app/node_modules/graceful-fs/graceful-fs.js:61:14
#0 3.063 at FSReqCallback.oncomplete (node:fs:198:23) {
#0 3.063 opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
#0 3.063 library: 'digital envelope routines',
#0 3.063 reason: 'unsupported',
#0 3.063 code: 'ERR_OSSL_EVP_UNSUPPORTED'
#0 3.063 }
#0 3.063
#0 3.063 Node.js v18.16.0
------
Dockerfile:8
--------------------
6 | RUN npm install
7 | COPY . .
8 | >>> RUN npm run build
9 |
10 | # production stage
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
I would appreciate if you could explain the work around using environment variable. I have tried building from the 'dev' branch and get other unrelated errors.
Here's an SO reply (https://stackoverflow.com/a/74488988) that explains how to run webpack 4 on Node 17 and above.
Yeah I have tried that environment variable and still get issues with missing files when trying to do npm run build. I am not a node expert so I think I might have to wait until master is fixed.
I have tried to build locally on Ubuntu 22.04 LTS.
I get this error when doing npm run build
`$ npm run build
aggr@3.3.2 build /data/external-repos/aggr
vue-cli-service build
sh: 1: vue-cli-service: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! aggr@3.3.2 build: vue-cli-service build
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the aggr@3.3.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
`
I think I have installed volta ok, not sure if vue-cli is install correctly though. I did install using:
npm install -g @vue/cli
npm install create-vue@latest
I have tried removing node_modules and package-lock.json and doing npm install
again. I have also tried chmod a+x on node_modules and same issue. Even if I chmod 777 the whole repo I still get permission issue.
Entirely possible these problems are to do with my local environment and nothing to do with the repo. Hence why I wanted to use the docker image :)
What about?
chmod -R a+x node_modules
Yes, sorry I did apply the perms recursively. Still same issue.
Hello,
I have proposed a fix for the Docker setup here #330
You will need to install volta.sh.
Check out the PR branch, then type in the terminal:
docker build -t aggr-ui -f ./Dockerfile .
docker run -p 3001:80 aggr-ui
This should work right off the bat. There are some functionalities that will not work at this point in time: alerts and historical data.
In order to fix that, you would have to run aggr-server
. I will prepare some documentation to help you guys out with the configuration. Please test it out for me, I need some review. Thank you.