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

Docker build fails #143

Closed
dudeperf3ct opened this issue Sep 21, 2022 · 3 comments
Closed

Docker build fails #143

dudeperf3ct opened this issue Sep 21, 2022 · 3 comments

Comments

@dudeperf3ct
Copy link

dudeperf3ct commented Sep 21, 2022

Subject of the issue

I am following the instructions mentioned in Helm chart instructions. The configuration step mentions creating and hosting Bailo image. The image can be built using docker build -t bailo . from root directory of project.

This step fails to build a docker image.

Your environment

  • version / commit hash of bailo (git rev-parse HEAD) : main branch
  • runtime environment (docker-compose, openshift) : kubectl / helm

Steps to reproduce

Running docker build -t bailo . from root directory.

Error

unable to convert uid/gid chown string to host mapping: can't find gid for group nextjs: no such group: nextjs

COPY command in docker recommends using --chown=<user>:<group>. Replacing --chown=nextjs:nextjswith --chown=nextjs:nodejs, the image build is a success.

Running the container, I get the following error

 bailo@0.3.0 start
> cross-env NODE_ENV=production node dist/server/index.js

node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module '../../lib/p-mongo-queue/pMongoQueue'
Require stack:
- /app/dist/server/utils/queues.js
- /app/dist/server/processors/processDeployments.js
- /app/dist/server/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/app/dist/server/utils/queues.js:10:39)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/app/dist/server/processors/processDeployments.js:13:18)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/app/dist/server/utils/queues.js',
    '/app/dist/server/processors/processDeployments.js',
    '/app/dist/server/index.js'
  ]
}
npm notice 
npm notice New minor version of npm available! 8.15.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice 

On comparing Dockerfile with Dockerfile.prod, I find that the following line is missing

COPY --from=builder --chown=nextjs:nextjs /app/lib/p-mongo-queue ./dist/lib/p-mongo-queue

Adding the above line with the right group, the build is a success.

Pushing this image and running the instructions as provided in helm chart instruction, the pod crashes with CrashLoopBackOff error.

Pod Events

Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  102s               default-scheduler  Successfully assigned bailo/bailo-6b995bcf9-g7wqh to bailo-control-plane
  Normal   Pulling    101s               kubelet            Pulling image "dudeperf3ct7/bailo:latest"
  Normal   Pulled     20s                kubelet            Successfully pulled image "dudeperf3ct7/bailo:latest" in 1m20.652425634s
  Warning  Unhealthy  20s                kubelet            Readiness probe failed: Get "http://10.244.0.5:3000/": dial tcp 10.244.0.5:3000: connect: connection refused
  Normal   Created    19s (x2 over 20s)  kubelet            Created container bailo
  Normal   Started    19s (x2 over 20s)  kubelet            Started container bailo
  Normal   Pulled     19s                kubelet            Container image "dudeperf3ct7/bailo:latest" already present on machine
  Warning  BackOff    12s (x4 over 18s)  kubelet            Back-off restarting failed container

Tailing log for the pod provides following information

Failed to open temporary file /etc/ssl/certs/bundleXXXXXX for ca bundle
No schemas setup script set; You will have to add schemas after startup
Running 'npm run start'

Expected behaviour

Everything should work. i.e. just building the image and adding that to helm should give access to Model UI at 3000 port.

@a3957273
Copy link
Member

Removed Dockerfile, which was not updated and not functional. Instead, when building for a development container use Dockerfile.dev and when building for a production container use Dockerfile.prod.

@a3957273
Copy link
Member

Closed in #144

@dudeperf3ct
Copy link
Author

dudeperf3ct commented Sep 22, 2022

@a3957273, I followed the helm instructions and pushed a Bailo image (created from Dockerfile.prod) to docker hub registry. Upon writing a custom local.yaml file for overriding the Bailo image and running the further instructions, I still get the CrashLoopBackOff error (Back-off restarting failed container).

How can I resolve this error? I have provided detailed information in the last section of the issue.

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

No branches or pull requests

2 participants