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

PROJECT_NAME_node exited with code 0 #3

Open
featherbelly opened this issue Dec 4, 2018 · 2 comments
Open

PROJECT_NAME_node exited with code 0 #3

featherbelly opened this issue Dec 4, 2018 · 2 comments

Comments

@featherbelly
Copy link

HI there, I'm using the wodby/docker4drupal stack. Really great and useful!

I'm having a problem with the node container - this is my config in docker-compose.yml:

  node:
    image: wodby/node:$NODE_TAG
    container_name: "${PROJECT_NAME}_node"
    working_dir: /usr/src/app/sites/all/themes/AMG
    labels:
      - 'traefik.backend=node'
      - 'traefik.port=3000'
      - 'traefik.frontend.rule=Host:front.${PROJECT_BASE_URL}'
    expose:
      - "3000"
    volumes:
      - ./app/sites/all/themes/AMG:/usr/src/app/sites/all/themes/AMG
    command: 'yarn install'

If I run docker-compose --verbose up node:

Attaching to amg_node
compose.cli.verbose_proxy.proxy_callable: docker events <- (filters={'label': ['com.docker.compose.project=website', 'com.docker.compose.oneoff=False']}, decode=True)
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dwebsite%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker events -> <docker.types.daemon.CancellableStream object at 0x1108fa860>
amg_node     | yarn install v1.10.1
amg_node     | [1/4] Resolving packages...
amg_node     | [2/4] Fetching packages...
amg_node     | info [email protected]: The platform "linux" is incompatible with this module.
amg_node     | info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
amg_node     | [3/4] Linking dependencies...
amg_node     | [4/4] Building fresh packages...
amg_node     | Done in 142.78s.
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('1d74a5b48ab791cc3e6c196abc20faff52bbce82646cbe5c680abcba975702be')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('1d74a5b48ab791cc3e6c196abc20faff52bbce82646cbe5c680abcba975702be')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/1d74a5b48ab791cc3e6c196abc20faff52bbce82646cbe5c680abcba975702be/json HTTP/1.1" 200 None
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/containers/1d74a5b48ab791cc3e6c196abc20faff52bbce82646cbe5c680abcba975702be/wait HTTP/1.1" 200 30
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['yarn', 'install'],
 'Config': {'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['yarn', 'install'],
            'Domainname': '',
            'Entrypoint': ['/docker-entrypoint.sh'],
            'Env': ['PATH=/home/node/.yarn/bin:/usr/src/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
                    'NODE_VERSION=10.13.0',
...
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 0}
amg_node exited with code 0

Any ideas what I'm doing wrong?

@featherbelly
Copy link
Author

featherbelly commented Dec 4, 2018

If I create a simple gulpfile and declare this in the package.json then the container runs... e.g.

  "main": "gulpfile.babel.js",
  "scripts": {
    "start": "gulp",
    "build": "gulp build --production"
  },

With this command in docker-compose.yml:

command: sh -c 'yarn install && yarn run start'

Container then builds / runs. I can then access the container using docker exec, e.g.

docker exec -ti PROJECT_NAME_node bash

Is here a way to build the container without the need to call a command...?

I want to be able to access container to add dependencies from CLI, e.g.

yarn add gulp-watch --dev

@csandanov
Copy link
Member

You can add gulp-watch as a dev dependency in package.json with the script that runs it. Add environment NODE_ENV: dev to the service in compose file so yarn install would install your dev packages.

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