From 5e5df6094a697986453034e58d049e21d33dfe66 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Mon, 19 Dec 2022 16:44:33 -0500 Subject: [PATCH] first attempt at variant node based build container. --- .gitignore | 2 +- Jenkinsfile | 8 ++++++++ node_base/Dockerfile | 45 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 node_base/Dockerfile diff --git a/.gitignore b/.gitignore index ae90088..befb72e 100644 --- a/.gitignore +++ b/.gitignore @@ -75,7 +75,7 @@ flycheck_*.el # ---> JetBrains # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - +.idea # User-specific stuff .idea/**/workspace.xml .idea/**/tasks.xml diff --git a/Jenkinsfile b/Jenkinsfile index f10e5c2..f5cc6dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,6 +28,14 @@ pipeline { } } + script{ + //including withRegistry block for now... currently not authenticating or pushing to git.vdb.to + docker.withRegistry('https://git.vdb.to'){ + echo 'Building foundation base node 16 image...' + def foundation_image = docker.build("cerc-io/foundation_node16:jenkinscicd", "--build-arg VARIANT=16 node_base/") + echo 'built foundation image' + } + } } } } diff --git a/node_base/Dockerfile b/node_base/Dockerfile new file mode 100644 index 0000000..6249ee0 --- /dev/null +++ b/node_base/Dockerfile @@ -0,0 +1,45 @@ + +# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +ARG VARIANT=16-bullseye +FROM node:${VARIANT} + +ARG USERNAME=node +ARG NPM_GLOBAL=/usr/local/share/npm-global + +# Add NPM global to PATH. +ENV PATH=${NPM_GLOBAL}/bin:${PATH} + +RUN \ + # Configure global npm install location, use group to adapt to UID/GID changes + if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \ + && usermod -a -G npm ${USERNAME} \ + && umask 0002 \ + && mkdir -p ${NPM_GLOBAL} \ + && touch /usr/local/etc/npmrc \ + && chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \ + && chmod g+s ${NPM_GLOBAL} \ + && npm config -g set prefix ${NPM_GLOBAL} \ + && su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \ + # Install eslint + && su ${USERNAME} -c "umask 0002 && npm install -g eslint" \ + && npm cache clean --force > /dev/null 2>&1 + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment if you want to install an additional version of node using nvm +# ARG EXTRA_NODE_VERSION=10 +# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" + +# [Optional] Uncomment if you want to install more global node modules +# RUN su node -c "npm install -g " + +COPY build-npm-package.sh . + +COPY entrypoint.sh . +ENTRYPOINT ["./entrypoint.sh"] +# Placeholder CMD : generally this will be overridden at run time like : +# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build' +CMD node --version \ No newline at end of file