@@ -4,22 +4,27 @@ MAINTAINER MagicVision Team
4
4
5
5
RUN apt-get update -y
6
6
7
+ # Add a normal user with sudo permission
8
+ RUN adduser --disabled-password --gecos "" ubuntu && echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu
9
+
7
10
# Install nvm
8
11
RUN apt-get install -y curl build-essential libssl-dev man && \
9
- curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
12
+ curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | su - ubuntu -c sh && \
13
+ echo 'export NVM_DIR="$HOME/.nvm"' >> /etc/profile && \
14
+ echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> /etc/profile
10
15
11
16
# Install node.js 4.1.0
12
- RUN bash -ic "nvm install 4.1.0" && \
13
- bash -ic "nvm alias default 4.1.0" && \
14
- bash -ic "nvm use 4.1.0"
17
+ RUN su - ubuntu -c "nvm install 4.1.0" && \
18
+ su - ubuntu -c "nvm alias default 4.1.0" && \
19
+ su - ubuntu -c "nvm use 4.1.0"
15
20
16
21
# Use Taobao node mirror and npm registry
17
22
ENV NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
18
- RUN /root/.nvm/v4.1.0/bin/ npm config set registry http://registry.npm.taobao.org
23
+ RUN su - ubuntu -c " npm config set registry http://registry.npm.taobao.org"
19
24
20
25
# Provisioning gitlab CA
21
26
ADD gitlab-CA.crt /usr/local/share/ca-certificates/
22
- RUN update-ca-certificates
27
+ RUN sudo update-ca-certificates
23
28
24
29
# Install docker-cli
25
30
# See https://github.com/docker-library/docker/blob/bb15fc25bbd4f51a880cf02f91eab447b1083b75/1.8/Dockerfile
@@ -40,7 +45,7 @@ RUN apt-get install -y git
40
45
RUN apt-get install -y python
41
46
42
47
# Install bower
43
- RUN apt-get install -y libkrb5-dev && bash -ic "npm install -g bower"
48
+ RUN apt-get install -y libkrb5-dev && su - ubuntu -c "npm install -g bower"
44
49
45
50
# Use tsinghua ubuntu mirror
46
51
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list && \
@@ -51,4 +56,8 @@ RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted
51
56
apt-get update -y
52
57
53
58
COPY ./entrypoint.sh /
59
+ RUN chmod 755 /entrypoint.sh
60
+
61
+ # Run as a normal user
62
+ USER ubuntu
54
63
ENTRYPOINT ["/entrypoint.sh" ]
0 commit comments