-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathDockerfile
65 lines (53 loc) · 1.96 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
#simple angular-cli docker installation
#docker build -t ng-cli .
#or specify angular-cli version
#docker build --build-arg NG_CLI_VERSION=19.2.4
#FROM node:alpine
#alternative to reduce size instead of alpine, but does not
#include build tools for native compilation of npm packages
#we therefore add gcc
FROM node:lts-slim
#MAINTAINER trion development GmbH "[email protected]"
LABEL maintainer="trion development GmbH <[email protected]>"
ARG USER_HOME_DIR="/tmp"
ARG APP_DIR="/app"
ARG USER_ID=1000
# ENV USER_ID=${USER_ID}
#reduce logging, disable angular-cli analytics for ci environment
ENV NPM_CONFIG_LOGLEVEL=warn NG_CLI_ANALYTICS=false TZ=UTC
#angular-cli rc0 crashes with .angular-cli.json in user home
ENV HOME "$USER_HOME_DIR"
#not declared to avoid anonymous volume leak
#but when not manually bound to host fs, performance will suffer!
#VOLUME "$USER_HOME_DIR/.cache/yarn"
#VOLUME "$APP_DIR/"
WORKDIR $APP_DIR
EXPOSE 4200
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
RUN apt-get update && apt-get install -qqy --no-install-recommends \
ca-certificates \
dumb-init \
git \
build-essential \
python3 \
procps \
rsync \
curl \
zip \
openssh-client \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG NG_CLI_VERSION=19.2.4
LABEL angular-cli=$NG_CLI_VERSION node=$NODE_VERSION
# npm 5 uses different userid when installing packages, as workaround su to node when installing
# see https://github.com/npm/npm/issues/16766
RUN set -xe \
&& mkdir -p $USER_HOME_DIR \
&& chown $USER_ID $USER_HOME_DIR \
&& chmod a+rw $USER_HOME_DIR \
&& mkdir -p $APP_DIR \
&& chown $USER_ID $APP_DIR \
&& chown -R node /usr/local/lib /usr/local/include /usr/local/share /usr/local/bin \
&& (cd "$USER_HOME_DIR"; su node -c "npm install -g @angular/cli@$NG_CLI_VERSION; npm install -g pnpm; npm cache clean --force")
USER $USER_ID