Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Node Js Dockerfiles to Node 10.15.0 (Alpine) #117

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -25,9 +25,9 @@ This project is part of the OpenFaaS project licensed under the MIT License.
| go-armhf | Go | 1.10.4 | Alpine Linux 3.8 | Classic | [Go armhf template](https://github.com/openfaas/templates/tree/master/template/go-armhf)
| go | Go | 1.10.4 | Alpine Linux 3.8 | Classic | [Go template](https://github.com/openfaas/templates/tree/master/template/go)
|java8 | Java | 8 | OpenJDK Alpine Linux | of-watchdog | [Java template](https://github.com/openfaas/templates/tree/master/template/java8)
| node-arm64 | NodeJS | 8.9.1 | N/A | Classic | [NodeJS arm64 template](https://github.com/openfaas/templates/tree/master/template/node-arm64)
| node-armhf | NodeJS | N/A | Alpine Linux 3.6 | Classic | [NodeJS armhf template](https://github.com/openfaas/templates/tree/master/template/node-armhf)
| node | NodeJS | 8.9.1 | Alpine Linux | Classic | [NodeJS template](https://github.com/openfaas/templates/tree/master/template/node)
| node-arm64 | NodeJS | 10.15.0 | Alpine Linux | Classic | [NodeJS arm64 template](https://github.com/openfaas/templates/tree/master/template/node-arm64)
| node-armhf | NodeJS | 10.15.0 | Alpine Linux | Classic | [NodeJS armhf template](https://github.com/openfaas/templates/tree/master/template/node-armhf)
| node | NodeJS | 10.15.0 | Alpine Linux | Classic | [NodeJS template](https://github.com/openfaas/templates/tree/master/template/node)
| php7 | PHP | 7.2 | Alpine Linux | Classic | [PHP 7 template](https://github.com/openfaas/templates/tree/master/template/php7)
| python-armhf | Python | 2.7 | Alpine Linux | Classic | [Python 2.7 armhf template](https://github.com/openfaas/templates/tree/master/template/python-armhf)
| python | Python | 2.7 | Alpine Linux | Classic | [Python 2.7 template](https://github.com/openfaas/templates/tree/master/template/python)
Expand Down
50 changes: 30 additions & 20 deletions template/node-arm64/Dockerfile
@@ -1,41 +1,51 @@
FROM arm64v8/node:8.9.1
FROM node:10.15.0-alpine

RUN apt-get update -qy \
&& apt-get install -qy curl ca-certificates --no-install-recommends \
RUN addgroup -S app && adduser app -S -G app
RUN apk --no-cache add ca-certificates curl \
&& echo "Pulling watchdog binary from Github." \
&& curl -sSL https://github.com/openfaas/faas/releases/download/0.9.14/fwatchdog-arm64 > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog \
&& apt-get -qy remove curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
&& apk del curl --no-cache

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

HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1

CMD ["fwatchdog"]
CMD ["fwatchdog"]
47 changes: 34 additions & 13 deletions template/node-armhf/Dockerfile
@@ -1,30 +1,51 @@
FROM arm32v6/alpine:3.6
FROM node:10.15.0-alpine

RUN apk add --no-cache nodejs nodejs-npm ca-certificates
RUN apk --no-cache add curl \
RUN addgroup -S app && adduser app -S -G app
RUN apk --no-cache add ca-certificates curl \
&& echo "Pulling watchdog binary from Github." \
&& curl -sSL https://github.com/openfaas/faas/releases/download/0.9.14/fwatchdog-armhf > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog \
&& apk del curl --no-cache

WORKDIR /root/

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

RUN npm i
COPY index.js .
COPY function function
WORKDIR /root/function
RUN mkdir -p /home/app

ENV NPM_CONFIG_LOGLEVEL warn
RUN npm i || :
WORKDIR /root/
# Wrapper/boot-strapper
WORKDIR /home/app
COPY package.json ./

ENV cgi_headers="true"
# This ordering means the npm installation is cached for the outer function handler.
RUN npm i --production

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

HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1

CMD ["fwatchdog"]
CMD ["fwatchdog"]
4 changes: 2 additions & 2 deletions template/node/Dockerfile
@@ -1,4 +1,4 @@
FROM node:8.9.1-alpine
FROM node:10.15.0-alpine

RUN addgroup -S app && adduser app -S -G app
RUN apk --no-cache add curl \
Expand Down Expand Up @@ -48,4 +48,4 @@ EXPOSE 8080

HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1

CMD ["fwatchdog"]
CMD ["fwatchdog"]