-
Notifications
You must be signed in to change notification settings - Fork 28
/
Dockerfile
89 lines (80 loc) · 2.86 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM node:9-alpine
LABEL org.label-schema.schema-version = 1.0.0 \
org.label-schema.vendor = [email protected] \
org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \
org.label-schema.description = "This image provides node based build tools." \
org.label-schema.name = "NPM" \
org.label-schema.url = http://mkenney.github.io/docker-npm/
ENV TERM=xterm \
NLS_LANG=American_America.AL32UTF8 \
LANG=C.UTF-8 \
LANGUAGE=C.UTF-8 \
LC_ALL=C.UTF-8 \
TIMEZONE=America/Denver
########################################################################
# Build tools
########################################################################
RUN set -x \
&& apk update \
&& apk add \
acl \
ca-certificates \
curl \
git \
gnupg \
mercurial \
rsync \
shadow \
subversion \
sudo
RUN set -x \
&& touch /root/.profile \
# Install node packages
&& npm install --silent -g \
gulp-cli \
grunt-cli \
bower \
markdown-styles \
npx \
# Configure root account
&& echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \
&& echo "export LANG=$(echo $LANG)" >> /root/.profile \
&& echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \
&& echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \
&& echo "export TERM=xterm" >> /root/.profile \
&& echo "export PATH=$(echo $PATH)" >> /root/.profile \
&& echo "cd /src" >> /root/.profile \
# Create a dev user to use as the directory owner
&& addgroup dev \
&& adduser -D -s /bin/sh -G dev dev \
&& echo "dev:password" | chpasswd \
&& curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \
&& rsync -a /root/ /home/dev/ \
&& chown -R dev:dev /home/dev/ \
&& chmod 0777 /home/dev \
&& chmod -R u+rwX,g+rwX,o+rwX /home/dev \
&& setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \
# Setup wrapper scripts
&& curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \
&& chmod 0755 /run-as-user
##############################################################################
# ~ fin ~
##############################################################################
RUN set -x \
&& apk del \
curl \
gnupg \
linux-headers \
paxctl \
python \
rsync \
tar \
&& rm -rf \
/var/cache/apk/* \
${NODE_PREFIX}/lib/node_modules/npm/man \
${NODE_PREFIX}/lib/node_modules/npm/doc \
${NODE_PREFIX}/lib/node_modules/npm/html
VOLUME /src
WORKDIR /src
ENTRYPOINT ["/run-as-user"]
CMD ["/usr/local/bin/npm"]