forked from apim-haufe-io/wicked.env
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-alpine
52 lines (45 loc) · 1.97 KB
/
Dockerfile-alpine
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
FROM node:8-alpine
ENV GOSU_VERSION=1.10
RUN addgroup -S -g 888 wicked && adduser -S -G wicked -u 888 wicked
RUN set -x \
&& apk add --no-cache --virtual .gosu-deps \
dpkg \
gnupg \
openssl \
git \
bash \
&& wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 \
&& chmod +x /usr/local/bin/dumb-init \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver hkp://ipv4.pool.sks-keyservers.net:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apk del gnupg \
&& rm -rf /var/cache/apk/*
RUN mkdir -p /usr/src/portal-env /usr/src/app && chown -R wicked:wicked /usr/src && \
mkdir -p /home/wicked && chown -R wicked:wicked /home/wicked
USER wicked
COPY . /usr/src/portal-env
COPY package.all.json /usr/src/app/package.json
WORKDIR /usr/src/app
RUN cd ../portal-env \
&& npm pack \
&& mv portal-env-* ../portal-env.tgz \
&& cd /usr/src/app \
&& npm install
# We install all node_modules in this base image; no need to do it later
# ONBUILD COPY package.json /usr/src/app/
# ONBUILD RUN npm install
ONBUILD RUN date -u "+%Y-%m-%d %H:%M:%S" > /usr/src/app/build_date
ONBUILD COPY . /usr/src/app
ONBUILD RUN if [ -d ".git" ]; then \
git log -1 --decorate=short > /usr/src/app/git_last_commit && \
git rev-parse --abbrev-ref HEAD > /usr/src/app/git_branch; \
fi
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["npm", "start" ]