Skip to content

Commit

Permalink
Update node-armhf template
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Feb 5, 2020
1 parent 94e53f4 commit e017a2a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ build
.gradle
.idea
**/bin/**
.settings
1 change: 1 addition & 0 deletions template/node-armhf/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/node_modules
25 changes: 15 additions & 10 deletions template/node-armhf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,42 @@ RUN chmod +x /usr/bin/fwatchdog

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

RUN apk add --no-cache nodejs nodejs-npm ca-certificates
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 ./

COPY package.json .
# This ordering means the npm installation is cached for the outer function handler.
RUN npm i --production

RUN npm i
# Copy outer function handler
COPY index.js ./

# 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 || :

COPY index.js .
COPY function function

ENV NPM_CONFIG_LOGLEVEL warn
RUN npm i || :

# 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
5 changes: 0 additions & 5 deletions template/node-armhf/build.sh

This file was deleted.

11 changes: 11 additions & 0 deletions template/node-armhf/template.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
language: node-armhf
fprocess: node index.js
welcome_message: |
This template is designed for Raspberry Pi / 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 e017a2a

Please sign in to comment.