azukiapp/azk

Fails to rebuild from Dockerfile - lstat .npmrc: no such file or directory although file exists.

Opened this issue · 1 comments

ilaif commented
  1. What are you trying to accomplish?

To restart a system with new changes to Dockerfile, i.e - rebuilding it.

  1. Steps to reproduce the described behavior

azk restart <system_name> --rebuild -R --verbose

  1. Output
azk restart api --rebuild --verbose -R                                                                                                                                             
azk: System `api` not running
azk: ↑ starting `api` system, 1 new instances...
azk: ✓ checking `azkbuild/55407520be-api:ff32ca456477dae7401769e78f1d616a0e4e0e0f` image...
azk: ⇲ building `azkbuild/55407520be-api:ff32ca456477dae7401769e78f1d616a0e4e0e0f` image...
Warning: Promise.defer is deprecated and will be removed in a future version. Use new Promise instead.
    at originalDefer (workspace-0.18.0 - src/utils/promises.js:145:18)
    at _callee$ (workspace-0.18.0 - src/docker/build.js:3:30)
    at tryCatch (/usr/local/Cellar/azk/0.18.0/node_modules/babel-polyfill/node_modules/babel-regenerator-runtime/runtime.js:61:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/Cellar/azk/0.18.0/node_modules/babel-polyfill/node_modules/babel-regenerator-runtime/runtime.js:329:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/Cellar/azk/0.18.0/node_modules/babel-polyfill/node_modules/babel-regenerator-runtime/runtime.js:94:21)
    at /usr/local/Cellar/azk/0.18.0/node_modules/file-async/node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:76:16
From previous event:
    at async (workspace-0.18.0 - src/utils/promises.js:28:29)
    at Start.index (workspace-0.18.0 - src/cmds/scale.js:5:15)
    at Start.before_action (/cli-router:0.3.6/src/cli_controller.js:27:43)
    at workspace-0.18.0 - src/cli/cli_tracker_controller.js:6:34
    at process._tickCallback (node.js:448:13)
    at Function.Module.runMain (module.js:499:11)
From previous event:
    at Start.before_action (workspace-0.18.0 - src/cli/cli_tracker_controller.js:15:48)
    at Start.run_action (/cli-router:0.3.6/src/cli_controller.js:23:30)
    at Start.run_action (workspace-0.18.0 - src/cli/cli_controller.js:5:27)
    at fn (/cli-router:0.3.6/src/cli_router.js:89:39)
    at CliRouter.run (/cli-router:0.3.6/src/cli_router.js:196:14)
    at Cli.run (/cli-router:0.3.6/src/index.js:56:28)
    at run (workspace-0.18.0 - src/cli/index.js:48:20)
    at cli (workspace-0.18.0 - src/cli/index.js:61:25)
    at Object.<anonymous> (/usr/local/Cellar/azk/0.18.0/bin/azk.js:42:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:935:3

  Step 1 : FROM node:5.3.0-wheezy
  Step 2 : MAINTAINER ****
  Step 3 : RUN apt-get clean && apt-get update
  Step 4 : RUN apt-get install -y --no-install-recommends zlib1g-dev libssl-dev libcurl4-openssl-dev make build-essential     apt-utils libmcrypt4 libmcrypt-dev curl wget sed git vim less zip openssh-server logrotate mysql-client
  Step 5 : RUN npm install -g nodemon mocha
  Step 7 : CMD node api.js
azk: An error occurred. It will stop all instances already running. See details below.

azk: System `api` not running
azk: An unexpected error occurred in the build `/Users/<USER>/git/analoc/bolt/Dockerfile:
azk:     Step 1 : FROM node:5.3.0-wheezy
azk:      ---> 9eadfadbb80c
azk:     Step 2 : MAINTAINER ****
azk:      ---> Using cache
azk:      ---> 6e84ea17949b
azk:     Step 3 : RUN apt-get clean && apt-get update
azk:      ---> Using cache
azk:      ---> 6d07f4e9e41a
azk:     Step 4 : RUN apt-get install -y --no-install-recommends zlib1g-dev libssl-dev libcurl4-openssl-dev make build-essential     apt-utils libmcrypt4 libmcrypt-dev curl wget sed git vim less zip openssh-server logrotate mysql-client
azk:      ---> Using cache
azk:      ---> a91fb42114b8
azk:     Step 5 : RUN npm install -g nodemon mocha
azk:      ---> Using cache
azk:      ---> ccdee27287e6
azk:     Step 6 : EXPOSE 80
azk:      ---> Using cache
azk:      ---> 5fdb1aeea14b
azk:     Step 7 : CMD node api.js
azk:      ---> Using cache
azk:      ---> 6a7e0d8fa6d4
azk:     Step 8 : ARG NPM_TOKEN
azk:      ---> Using cache
azk:      ---> 9dedc157d023
azk:     Step 9 : COPY .npmrc /tmp/.npmrc
azk:     lstat .npmrc: no such file or directory

azk: Sorry, an error has occurred.
azk: A crash report about this error will be sent to azk team in order to make azk better.
azk: Sending bug report to Azuki...
azk: Bug report was sent. Thanks.
  1. Further info

a. Which OS / distro? OS X El-Capitan
b. Which VirtualBox version? VirtualBox: 5.0.14r105127
c. Can you provide us your Azkfile.js?

systems({
   api: {
        depends: ['redis', 'mysql'],
        image: {
            dockerfile: './bolt'
        },
        provision: [
            'cp .npmrc ..',
            'cp package.json ..',
            'cd /app',
            'npm install --no-bin-links --no-optional',
            'cd /app/code'
        ],
        workdir: '/app/code',
        shell: '/bin/bash',
        command: ['node', '--debug=3001', 'api.js'],
        mounts: {
            // '/app/code': sync('./bolt'),
            // '/app/node_modules': persistent('node_modules')
        },
        http: {
            //domains: ['#{system.name}.local.io']
        },
        ports: {
            http: '8085:80/tcp',
            debug: '3001:3001'
        },
        envs: {
            NODE_ENV: 'development',
            MYSQL_HOST: 'dev.azk.io',
            MYSQL_PASSWORD: 'root',
            LOG_CONSOLE_LEVEL: 'debug'
        }
  });

ProTip: run azk version --full to gather those info.
ALL INFO:
Version : azk version 0.18.0, build 8b9f66c, date 2016-04-06
OS : OS X (x64), Memory: 16384MB
Agent : Running
Docker : 1.9.1
Uses VM : Yes, ip: 192.168.50.4
VirtualBox: 5.0.14r105127

  1. Do you have any suggestions on how to tackle this?
  • The file '.npmrc' exists.
  • It seems that when I do "adocker build ." in the project folder everything works, so it's specifically an AZK problem.
  • Another side request: How to deal with the deprecated .defer promise warning?
  • I've tried erasing all containers, images, restart azk agent...

Thanks in advance,
Ilai

ilaif commented

Progress: Apparently azk is having problems copying into docker files who start with ".". I've renamed ".npmrc" to "npmrc" and then used "COPY npmrc /tmp/.npmrc" to keep the expected behavior and now I can successfully build with "azk restart --rebuild".

Probably a bug as far as I understand.