Skip to content

Commit

Permalink
Update node-arm64 to latest
Browse files Browse the repository at this point in the history
This brings the three templates of the node-* name into parity.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Feb 5, 2020
1 parent e017a2a commit b9e6b82
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
1 change: 1 addition & 0 deletions template/node-arm64/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/node_modules
40 changes: 27 additions & 13 deletions template/node-arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,44 @@ FROM node:12.13.0-alpine as ship
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog

RUN addgroup -S app && adduser app -S -G app

WORKDIR /root/

# Turn down the verbosity to default level.
ENV NPM_CONFIG_LOGLEVEL warn

RUN mkdir -p /home/app

# Wrapper/boot-strapper
COPY package.json .
RUN npm i
WORKDIR /home/app
COPY package.json ./

# Function
COPY index.js .
RUN mkdir -p ./root/function
# This ordering means the npm installation is cached for the outer function handler.
RUN npm i --production

COPY function/*.json ./function/
WORKDIR /root/function
RUN npm i || :
WORKDIR /root/
COPY function function
WORKDIR /root/function
# Copy outer function handler
COPY index.js ./

WORKDIR /root/
# COPY function node packages and install, adding this as a separate
# entry allows caching of npm install runtime dependencies
WORKDIR /home/app/function
COPY function/*.json ./
RUN npm i --production || :

ENV cgi_headers="true"
# Copy in additional function files and folders
COPY --chown=app:app function/ .

WORKDIR /home/app/

# chmod for tmp is for a buildkit issue (@alexellis)
RUN chmod +rx -R ./function \
&& chown app:app -R /home/app \
&& chmod 777 /tmp

USER app

ENV cgi_headers="true"
ENV fprocess="node index.js"
EXPOSE 8080

Expand Down
11 changes: 11 additions & 0 deletions template/node-arm64/template.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
language: node-arm64
fprocess: node index.js
welcome_message: |
This template is designed for 64-bit ARM.
You have created a new function which uses Node.js 12 (LTS) and the OpenFaaS
Classic Watchdog.
npm i --save can be used to add third-party packages like request or cheerio
npm documentation: https://docs.npmjs.com/
For high-throughput services, we recommend you use the node12 template which
uses a different version of the OpenFaaS watchdog.

0 comments on commit b9e6b82

Please sign in to comment.