Cannot configure both commands and custom attributes [user]

I am using the node:6.9.4 image in drone pipeline. I need it to run under the node user

Here is the .drone.yml:

pipeline:
build:
image: node:6.9.4
user: node
environment:
- WITH_SASL=0
commands:
- npm install --quiet
- npm test

The node image supports the ‘user: node’ setting. However, it appears to conflict with drone. Does anybody else know a way around this?

My real problem with using root user in my scenario is having to use node-gyp to build my repo. If you run npm install under root it can cause node-gyp to silently fail to build. The work around I found around this was to use this:

npm install --unsafe-perm

That got me moving forward but trying to have a consistent build from development, drone and into dockerhub is something I would like to achieve.

I believe you can set this value as an environment variable, so that you can use the same commands during the build and local development:

pipeline:
  build:
    environment:
+     - npm_config_unsafe_perm=true
    commands:
-     - npm install --unsafe-perm
+     - npm install
      - npm test

The challenge is that we use Docker volumes for the build workspace (where you code is cloned) and that volume is owned by root. As a result, if you try to access the cloned code as a non-root user you will get permission error messages. For this reason, the user field is ignored.