-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
59 lines (45 loc) · 1.41 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
# start with the node image
FROM alpine:latest as builder
#install nodejs into the base image
#use an older APK repo with openssl 1.0.2
RUN apk update && apk upgrade && \
rm -f /var/cache/apk/*
RUN apk add nodejs && \
rm -f /var/cache/apk/*
RUN apk add npm && \
rm -f /var/cache/apk/*
ENV LANG C.UTF-8
# copy app's source files to the image
COPY src/package*.json ./
COPY src/index.js ./
# pull all required node packages into the app
RUN node -v
RUN npm cache clean --force
RUN npm install
RUN npm install [email protected]
RUN rm -rf ./node_modules
RUN npm install --production
RUN npm dedupe
#copy again since npm install seems to overwrite this file
COPY src/index.js ./
FROM alpine:latest
LABEL maintainer="Predix Edge Application Services"
LABEL hub="https://hub.docker.com"
LABEL org="https://hub.docker.com/u/predixedge"
LABEL repo="predix-edge-sample-scaler-nodejs"
LABEL version="1.0.49"
LABEL support="https://forum.predix.io"
LABEL license="https://github.com/PredixDev/predix-docker-samples/blob/master/LICENSE.md"
RUN apk update && apk upgrade && \
rm -f /var/cache/apk/*
RUN apk add nodejs && \
rm -f /var/cache/apk/*
# Create app directory in the image
WORKDIR /usr/src/predix-edge-sample-scaler-nodejs
ENV LANG C.UTF-8
# copy app's source files to the image
COPY src/index.js ./
RUN mkdir -p node_modules
COPY --from=builder node_modules ./node_modules
# start the app
CMD [ "node", "index.js" ]