-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (46 loc) · 1.5 KB
/
Dockerfile
File metadata and controls
64 lines (46 loc) · 1.5 KB
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
FROM node:10.12.0-alpine
RUN addgroup -S app && adduser -S -g app app
# Alternatively use ADD https:// (which will not be cached by Docker builder)
RUN apk --no-cache add curl ca-certificates \
&& echo "Pulling watchdog binary from Github." \
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.6/of-watchdog > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog \
&& apk del curl
WORKDIR /root/
# Turn down the verbosity to default level.
ENV NPM_CONFIG_LOGLEVEL warn
RUN mkdir -p /home/app
# Wrapper/boot-strapper
WORKDIR /home/app
COPY package.json ./
# This ordering means the npm installation is cached for the outer function handler.
RUN npm i
# Copy outer function handler
COPY emptyApi.js ./
COPY FunctionContext.js ./
COPY FunctionEvent.js ./
COPY index.js ./
COPY log.js ./
COPY service.js ./
# COPY function node packages and install, adding this as a separate
# entry allows caching of npm install
WORKDIR /home/app/function
COPY function/*.json ./
RUN npm i || :
# COPY function files and folders
COPY function/ ./
# Set correct permissions to use non root user
WORKDIR /home/app/
# chmod for tmp is for a buildkit issue (@alexellis)
RUN chown app:app -R /home/app \
&& chmod 777 /tmp
USER app
ENV cgi_headers="true"
ENV fprocess="node index.js"
ENV mode="http"
ENV upstream_url="http://127.0.0.1:4000"
ENV exec_timeout="10s"
ENV write_timeout="15s"
ENV read_timeout="15s"
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]