Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Updates to not update base stack packages and some perf changes (#715)
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Groeger <[email protected]>

Co-authored-by: Kamran Shamsi <[email protected]>
  • Loading branch information
groeges and Kamran64 authored Mar 20, 2020
1 parent 2ea3ea5 commit a616d00
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
4 changes: 2 additions & 2 deletions incubator/node-red/image/Dockerfile-stack
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENV APPSODY_WATCH_DIR=/project/user-app
ENV APPSODY_WATCH_IGNORE_DIR=/project/user-app/node_modules
ENV APPSODY_WATCH_REGEX="^.*.json$"

ENV APPSODY_INSTALL="npm install --prefix user-app && npm audit fix --prefix user-app"
ENV APPSODY_INSTALL="npm install --prefix user-app"

ENV APPSODY_RUN="npm start"
ENV APPSODY_RUN_ON_CHANGE="npm start"
Expand All @@ -23,7 +23,7 @@ COPY ./LICENSE /licenses/
COPY ./project /project
COPY ./config /config
WORKDIR /project
RUN npm install && npm audit fix
RUN npm install

ENV PORT=3000
ENV NODE_PATH=/project/user-app/node_modules
Expand Down
36 changes: 14 additions & 22 deletions incubator/node-red/image/project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
# Install the app dependencies in a full Node docker image
FROM node:12

# Install OS updates
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get clean \
&& echo 'Finished installing dependencies'

# Copying individual files/folders as buildah 1.9.0 does not honour .dockerignore
COPY package*.json /project/
COPY *.js /project/
COPY user-app /project/user-app
# Removing node_modules as we can not make assumptions about file structure of user-app
RUN rm -rf /project/user-app/node_modules && mkdir -p /project/user-app/node_modules

# Install stack dependencies
WORKDIR /project
COPY ./package*.json ./
RUN npm install --production

# Install user-app dependencies
WORKDIR /project/user-app/
COPY ./user-app/package*.json ./
WORKDIR /project/user-app
RUN npm install --production
WORKDIR /project/user-app/node_modules

# Creating a tar to work around poor copy performance when using buildah 1.9.0
RUN cd / && tar czf project.tgz project

# Copy the dependencies into a slim Node docker image
FROM node:12-slim

# Install OS updates
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get clean \
&& echo 'Finished installing dependencies'

# Copy the project
COPY --chown=node:node . /project

# Copy all dependencies
COPY --chown=node:node --from=0 /project/node_modules /project/node_modules
COPY --chown=node:node --from=0 /project/user-app/node_modules /project/user-app/node_modules

# Copy project with dependencies
COPY --chown=node:node --from=0 /project.tgz /
RUN tar xf project.tgz && chown -R node:node /project && rm project.tgz
WORKDIR /project

ENV NODE_ENV production
Expand Down
2 changes: 1 addition & 1 deletion incubator/node-red/image/project/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-stack",
"version": "0.1.1",
"version": "0.1.2",
"description": "Node-RED Stack",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion incubator/node-red/stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Node-RED
version: 0.1.1
version: 0.1.2
description: Node-RED runtime for running flows
license: Apache-2.0
language: nodejs
Expand Down

0 comments on commit a616d00

Please sign in to comment.