I am creating a custom docker image based on ubuntu (testing:latest
). I want to run some unit tests for a meteor application.
FROM ubuntu:16.04
RUN apt-get update -y && \
apt-get install -yqq --no-install-recommends apt-transport-https ca-certificates curl nodejs-legacy && \
apt-get clean && apt-get autoclean && apt-get autoremove && \
curl https://install.meteor.com/ | sh && \
meteor npm install eslint eslint-plugin-react && \
apt-get remove -y apt-transport-https ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
I am using gitlab CI using a docker runner. So my yml file looks like
stages:
- test
lint:
image: testing:latest
stage: test
script:
- /node_modules/.bin/eslint --ext .js --ext .jsx .
except:
- master
unit:
image: testing:latest
stage: test
script:
- whoami
- meteor test --driver-package=practicalmeteor:mocha-console-runner
except:
- master
Running whoami
shows me that the current user is root
. Therefore meteor test is not running, as it shouldn't be used with root
You are attempting to run Meteor as the 'root' superuser. If you are
developing, this is almost certainly *not* what you want to do and will likely
result in incorrect file permissions. However, if you are running this command
in a build process (CI, etc.), or you are absolutely sure you know what you are
doing, set the METEOR_ALLOW_SUPERUSER environment variable or pass
--allow-superuser to proceed.
Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app
directory will be incorrect if you ever attempt to perform any Meteor tasks as
a normal user. If you need to fix your permissions, run the following command
from the root of your project:
sudo chown -Rh <username> .meteor/local
How can I use another user? Do I have to do that in the dockerfile? Or do I have to add some commands in the yml file?