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

Cannot build docker image #2814

Closed
1 of 3 tasks
pityonline opened this issue Jan 20, 2019 · 8 comments
Closed
1 of 3 tasks

Cannot build docker image #2814

pityonline opened this issue Jan 20, 2019 · 8 comments
Labels
bug Bugs in badges and the frontend self-hosting Discussion, problems, features, and documentation related to self-hosting Shields

Comments

@pityonline
Copy link

Are you experiencing an issue with...

🪲 Description

Hi, I'm trying to build a docker image and host shileds locally, so I just cloned the code and try building it, but an error occurred.

$ docker build -t shields .
Sending build context to Docker daemon  2.912MB
Error response from daemon: Dockerfile parse error line 19: unknown instruction: NODE

It seems we're missing the RUN keywork in line 19, I fixed it and run building again, and I got this error.

Step 9/15 : RUN npm install
 ---> Running in f088c77a58d9
npm WARN deprecated [email protected]: New custom equality api does not play well with all equality helpers. Please use v5.x
npm WARN deprecated [email protected]: no longer maintained
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! code ENOLOCAL
npm ERR! Could not install from "gh-badges" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-01-20T01_46_18_335Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1

Please take a look. If you have an official docker image, please add it to README. Thanks!

🔗 Link to the badge

💡 Possible Solution

paulmelnikow added a commit that referenced this issue Jan 20, 2019
@paulmelnikow paulmelnikow added the self-hosting Discussion, problems, features, and documentation related to self-hosting Shields label Jan 20, 2019
@paulmelnikow
Copy link
Member

Fixed in #2815.

It would be great to get some CI on the dockerfile. Since we don't use it in production or tests it's easy for it to skew out of date.

By the way there was recently an update to the way secrets are specified; if you're coming from an old version you should take a look at https://github.com/badges/shields/blob/master/doc/server-secrets.md.

@pityonline
Copy link
Author

@paulmelnikow Thank you for your update! I can build the image now, but when I tried to run it, a new error came out:

$ docker run --rm -p 8080:80 --name shields shields
[email protected] alert: no DSN provided, error reporting disabled
Configuration:
{ bind: { address: 'localhost' },
  metrics: { prometheus: { enabled: false, allowedIps: [] } },
  ssl: { isSecure: false },
  cors: { allowedOrigin: [ 'http://localhost:3000' ] },
  persistence: { dir: './private' },
  services:
   { github:
      { baseUri: 'https://api.github.com/',
        debug: { enabled: false, intervalSeconds: 200 } },
     trace: false },
  profiling: { makeBadge: false },
  cacheHeaders: { defaultCacheLengthSeconds: 120 },
  rateLimit: false,
  handleInternalErrors: false,
  fetchLimit: '10MB' }
0120124256 FsTokenPersistence configured with /usr/src/app/private/github-user-tokens.json
0120124256 Server is starting up: http://localhost/
{ Error: Cannot find module 'parse-link-header'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/src/app/services/github/github-contributors.service.js:4:25)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at servicePaths.forEach.path (/usr/src/app/services/index.js:22:20)
    at Array.forEach (<anonymous>)
    at loadServiceClasses (/usr/src/app/services/index.js:21:16)
    at Server.registerServices (/usr/src/app/core/server/server.js:183:5)
    at Server.start (/usr/src/app/core/server/server.js:263:10)
    at __dirname (/usr/src/app/server.js:28:18)
    at Object.<anonymous> (/usr/src/app/server.js:33:3)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3 code: 'MODULE_NOT_FOUND' }

I ran npm install manually in the container, then npm run start:server it seemed can be start.

/usr/src/app # npm run start:server

> [email protected] start:server /usr/src/app
> cross-env NODE_CONFIG_ENV=development node server 8080

[email protected] alert: no DSN provided, error reporting disabled
Configuration:
{ bind: { address: 'localhost', port: 8080 },
  metrics: { prometheus: { enabled: false, allowedIps: [] } },
  ssl: { isSecure: false },
  cors: { allowedOrigin: [ 'http://localhost:3000' ] },
  persistence: { dir: './private' },
  services:
   { github:
      { baseUri: 'https://api.github.com/',
        debug: { enabled: false, intervalSeconds: 200 } },
     trace: false },
  profiling: { makeBadge: false },
  cacheHeaders: { defaultCacheLengthSeconds: 120 },
  rateLimit: false,
  handleInternalErrors: false,
  fetchLimit: '10MB' }
0120124451 FsTokenPersistence configured with /usr/src/app/private/github-user-tokens.json
0120124451 Server is starting up: http://localhost:8080/

Any ideas?

@paulmelnikow
Copy link
Member

paulmelnikow commented Jan 20, 2019

Looks like another misclassified dependency: a dev dependency that needs to be a dependency.

@paulmelnikow paulmelnikow added the bug Bugs in badges and the frontend label Jan 20, 2019
@pityonline
Copy link
Author

@paulmelnikow Thank you for the response. Such a pity I couldn't help cuz I'm not familiar with JS. Hope it's gonna be fixed soon. 😸

@paulmelnikow
Copy link
Member

Do you know of good hosted tools for building and testing Docker images?

paulmelnikow added a commit that referenced this issue Jan 20, 2019
@chris48s
Copy link
Member

I think we should be able to just call docker run inside Circle CI. That would at least give a us a smoke test that it doesn't throw an error.

@paulmelnikow
Copy link
Member

I opened #2816.

@cthulu
Copy link

cthulu commented Mar 5, 2019

I've opened #3165 as the build does produce an image but it cannot be started (hangs forever).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in badges and the frontend self-hosting Discussion, problems, features, and documentation related to self-hosting Shields
Projects
None yet
Development

No branches or pull requests

4 participants