Skip to content

Commit

Permalink
layer nodejs images on top of s2i-core instead of s2i-base
Browse files Browse the repository at this point in the history
As we are installing npm packages in s2i-base that only get
removed during the build of actual nodejs images layered on top,
let us instead build the images directly on top of s2i-core to
preserve some image size.
  • Loading branch information
pkubatrh committed Oct 29, 2020
1 parent 19a850a commit 8bf955f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions 14/Dockerfile.rhel7
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rhscl/s2i-base-rhel7:1
FROM rhscl/s2i-core-rhel7:1

# This image provides a Node.JS environment you can use to run your Node.JS
# applications.
Expand Down Expand Up @@ -57,7 +57,6 @@ LABEL summary="$SUMMARY" \

RUN yum install -y yum-utils && \
prepare-yum-repositories rhel-server-rhscl-7-rpms && \
( [ "rh-${NAME}${NODEJS_VERSION}" != "${NODEJS_SCL}" ] && yum remove -y ${NODEJS_SCL}\* || : ) && \
INSTALL_PKGS="rh-nodejs${NODEJS_VERSION} rh-nodejs${NODEJS_VERSION}-npm rh-nodejs${NODEJS_VERSION}-nodejs-nodemon nss_wrapper" && \
ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
Expand Down
5 changes: 2 additions & 3 deletions 14/Dockerfile.rhel8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubi8/s2i-base:1
FROM ubi8/s2i-core:1

# This image provides a Node.JS environment you can use to run your Node.JS
# applications.
Expand Down Expand Up @@ -49,10 +49,9 @@ LABEL summary="$SUMMARY" \
help="For more information visit https://github.com/sclorg/s2i-nodejs-container" \
usage="s2i build <SOURCE-REPOSITORY> ubi8/$NAME-$NODEJS_VERSION:latest <APP-NAME>"

RUN yum -y module reset nodejs && yum -y module enable nodejs:$NODEJS_VERSION && \
RUN yum -y module enable nodejs:$NODEJS_VERSION && \
INSTALL_PKGS="nodejs npm nodejs-nodemon nss_wrapper" && \
ln -s /usr/lib/node_modules/nodemon/bin/nodemon.js /usr/bin/nodemon && \
yum remove -y $INSTALL_PKGS && \
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
yum -y clean all --enablerepo='*'
Expand Down

0 comments on commit 8bf955f

Please sign in to comment.