1
1
ARG ARCH=amd64
2
2
3
- FROM alpine as qemu
3
+ FROM alpine:3.9.2 as qemu
4
4
5
5
RUN apk add --no-cache curl
6
6
7
- ARG QEMU_VERSION=3.1.0-2
8
- ARG QEMU_ARCHS="arm aarch64"
7
+ ARG QEMU_VERSION=4.0.0
9
8
10
- RUN for i in ${QEMU_ARCHS}; \
11
- do \
12
- curl -fsSL https://github.com/multiarch/qemu-user-static/releases/download/v${QEMU_VERSION}/qemu-${i}-static.tar.gz \
13
- | tar zxvf - -C /usr/bin; \
14
- done \
15
- && chmod +x /usr/bin/qemu-*
9
+ # https://github.com/hadolint/hadolint/wiki/DL4006
10
+ SHELL ["/bin/ash" , "-o" , "pipefail" , "-c" ]
11
+
12
+ RUN curl -fsSL https://github.com/multiarch/qemu-user-static/releases/download/v${QEMU_VERSION}/qemu-arm-static.tar.gz | tar zxvf - -C /usr/bin
13
+ RUN curl -fsSL https://github.com/multiarch/qemu-user-static/releases/download/v${QEMU_VERSION}/qemu-aarch64-static.tar.gz | tar zxvf - -C /usr/bin
14
+
15
+ RUN chmod +x /usr/bin/qemu-*
16
16
17
17
# ----------------------------------------------------------------------------
18
18
19
- FROM ${ARCH}/node:11-alpine
19
+ FROM ${ARCH}/node:11-alpine as build
20
20
21
- # install qemu binaries used for cross-compiling
21
+ # copy qemu binaries used for cross-compiling
22
22
COPY --from=qemu /usr/bin/qemu-* /usr/bin/
23
23
24
24
RUN apk add --no-cache \
25
- git \
25
+ alpine-sdk \
26
26
curl \
27
- net-tools \
28
- drill
27
+ drill \
28
+ git \
29
+ net-tools \
30
+ python
29
31
30
32
WORKDIR /app
31
33
32
- # copy source files
33
34
COPY package.json ./
34
35
COPY source/ ./source
35
36
36
- # running as root user gets stuck @ node ./prebuilt-bindings install
37
- # as a workaround run as node user just for installation
38
- # https://github.com/nodejs/docker-node/issues/873
39
- RUN chown -R node:node /app
40
- USER node
37
+ RUN yarn install --ignore-optional --production
41
38
42
- RUN npm install --production --no-optional
43
-
44
- # switch back to root
45
- USER root
46
-
47
- # create link in path
48
- RUN ln -s /app/source/bin.js /usr/local/bin/dohnut
49
- RUN chmod +x /app/source/bin.js
39
+ # ----------------------------------------------------------------------------
50
40
51
- # remove qemu binaries used for cross-compiling
52
- RUN rm /usr/bin/qemu-*
41
+ FROM ${ARCH}/node:11-alpine
53
42
54
43
ARG BUILD_DATE
55
44
ARG BUILD_VERSION
@@ -65,4 +54,6 @@ LABEL org.label-schema.build-date="${BUILD_DATE}"
65
54
LABEL org.label-schema.version="${BUILD_VERSION}"
66
55
LABEL org.label-schema.vcs-ref="${VCS_REF}"
67
56
68
- ENTRYPOINT [ "dohnut" ]
57
+ COPY --from=build /app /app
58
+
59
+ ENTRYPOINT [ "node" , "/app/source/bin.js" ]
0 commit comments