parent
2e16d27289
commit
0f9381a479
@ -1,33 +1,45 @@
|
||||
FROM registry.access.redhat.com/ubi8:8.4 as build
|
||||
FROM registry.access.redhat.com/ubi9:9.0.0-1690 as build
|
||||
LABEL stage=builder
|
||||
|
||||
RUN dnf module install --nodocs -y nodejs:14 python39 --setopt=install_weak_deps=0 --disableplugin=subscription-manager \
|
||||
&& dnf install --nodocs -y git make gcc gcc-c++ --setopt=install_weak_deps=0 --disableplugin=subscription-manager \
|
||||
RUN dnf install --nodocs -y nodejs nodejs-nodemon npm --setopt=install_weak_deps=0 --disableplugin=subscription-manager \
|
||||
&& dnf install --nodocs -y make git gcc gcc-c++ --setopt=install_weak_deps=0 --disableplugin=subscription-manager \
|
||||
&& dnf clean all --disableplugin=subscription-manager
|
||||
|
||||
RUN mkdir -p /opt/app-root/src
|
||||
WORKDIR /opt/app-root/src
|
||||
COPY ./package.json /opt/app-root/src/package.json
|
||||
RUN npm install --no-audit --no-update-notifier --no-fund --production
|
||||
|
||||
COPY ./server.js /opt/app-root/src/
|
||||
COPY ./settings.js /opt/app-root/src/
|
||||
COPY ./.env /opt/app-root/src/
|
||||
COPY ./flow.json /opt/app-root/src/flow.json
|
||||
COPY ./flow_cred.json /opt/app-root/src/flow_cred.json
|
||||
|
||||
RUN mkdir -p /opt/app-root/data
|
||||
WORKDIR /opt/app-root/data
|
||||
COPY ./package.json /opt/app-root/data/package.json
|
||||
# Prevent "npm ERR! code ERR_SOCKET_TIMEOUT" by upgrading from npm 8.3 to >= npm 8.5.1
|
||||
RUN npm install --no-audit --no-update-notifier --no-fund --omit=dev --omit=optional --location=global npm@8.19.2
|
||||
RUN npm install --no-audit --no-update-notifier --no-fund --omit=dev
|
||||
|
||||
COPY ./settings.js /opt/app-root/data/
|
||||
COPY ./flow.json /opt/app-root/data/flows.json
|
||||
COPY ./flow_cred.json /opt/app-root/data/flows_cred.json
|
||||
|
||||
# Set permissions so that users can use Node-RED "Manage Palette" to add packages
|
||||
RUN chown -R 1000:1000 .
|
||||
|
||||
## Release image
|
||||
FROM registry.access.redhat.com/ubi8/nodejs-14-minimal:1
|
||||
# FROM registry.access.redhat.com/ubi9/nodejs-16-minimal:1-78
|
||||
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.0.0-1687
|
||||
|
||||
COPY --from=build /opt/app-root/src /opt/app-root/src/
|
||||
USER 0
|
||||
RUN microdnf update -y --nodocs --disableplugin=subscription-manager --setopt=install_weak_deps=0 && \
|
||||
microdnf install --nodocs -y nodejs nodejs-nodemon npm --setopt=install_weak_deps=0 && \
|
||||
microdnf clean all && \
|
||||
rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.*
|
||||
|
||||
WORKDIR /opt/app-root/src
|
||||
RUN mkdir -p /opt/app-root/data && chown 1000 /opt/app-root/data
|
||||
USER 1000
|
||||
COPY --from=build /opt/app-root/data /opt/app-root/data/
|
||||
WORKDIR /opt/app-root/data
|
||||
|
||||
ENV PORT 1880
|
||||
ENV NODE_ENV=production
|
||||
ENV NODE_PATH=/opt/app-root/data/node_modules
|
||||
#ENV TWCAPIKEY=
|
||||
#ENV HEREAPIKEY=
|
||||
#ENV WATSON_TTS=
|
||||
EXPOSE 1880
|
||||
|
||||
CMD ["node", "/opt/app-root/src/server.js", "/opt/app-root/src/flow.json"]
|
||||
CMD ["node", "/opt/app-root/data/node_modules/node-red/red.js", "--setting", "/opt/app-root/data/settings.js", "/opt/app-root/data/flows.json"]
|
||||
|
||||
Loading…
Reference in new issue