anchor.diff:    && chown -R 1000:0 \
       $NPM_PREFIX/lib/node_modules \
       $NPM_PREFIX/bin \
  -    $NPM_PREFIX/share
  +    $NPM_PREFIX/share \
  +    /.pm2 \
  +  && chmod g+w /.pm2
  +
  +# switch to the node user (uid 1000)
  +# non-root as provided by the base image
  +USER 1000
   
   # install pm2 globally
   RUN set -x && npm install -g pm2@$PM_VERSION
  
positive.code: # root application directory
  ENV KLICKER_DIR="/app"
  ENV PM_VERSION="2.8.0"
  
  # switch to the node user (uid 1000)
  # non-root as provided by the base image
  USER 1000
  
  # fix permissions for the global node directories
  # this allows installing pm2 globally as user 1000
  
negative.code: RUN set -x && yarn run build
  
  # run next in production mode
  CMD ["pm2-docker", "start", "--env", "production", "server.js"]
  
  # add labels
  LABEL maintainer="Roland Schlaefli <roland.schlaefli@bf.uzh.ch>"
  