<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Why is my node_modules folder deleted after docker build? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-node-modules-folder-deleted-after-docker-build/m-p/422399#M74210</link>
    <description>&lt;P&gt;Hi guys! &lt;/P&gt;

&lt;P&gt;I'm currently building a docker container with splunk/universalforwarder:7.0.0-monitor-k8s-logs as base image. During my docker build i install my own node.js and want to add my own scriptedinput scripts. &lt;/P&gt;

&lt;P&gt;my eventhub folder:&lt;/P&gt;

&lt;P&gt;/bin/myscript&lt;BR /&gt;
/bin/package.json&lt;/P&gt;

&lt;P&gt;Dockerfile:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FROM splunk/universalforwarder:7.0.0-monitor-k8s-logs

RUN apt-get update \ 
 &amp;amp;&amp;amp; apt-get install curl -y \
 &amp;amp;&amp;amp; curl -sL &lt;A href="https://deb.nodesource.com/setup_8.x" target="test_blank"&gt;https://deb.nodesource.com/setup_8.x&lt;/A&gt; | bash \
 &amp;amp;&amp;amp; sudo apt-get install -y nodejs 

COPY eventhub  /opt/splunk/etc/apps/eventhub/

WORKDIR /opt/splunk/etc/apps/eventhub/bin/

RUN npm i --production &amp;amp;&amp;amp; ls -al  &amp;lt;==
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;ls -al gives me that all are successfully created:&lt;/P&gt;

&lt;P&gt;myscript&lt;BR /&gt;
node_modules&lt;BR /&gt;
package.json&lt;BR /&gt;
package.json.lock&lt;/P&gt;

&lt;P&gt;However running my new image, the node_modules folder and package.json.lock is missing. After doing a manual npm install in the container everything is working.  &lt;/P&gt;

&lt;P&gt;Copying the files to /opt/splunk/  and doing the npm install there and not to /opt/splunk/etc the files are there. &lt;/P&gt;

&lt;P&gt;I think it has something to do with the base image volumes of /opt/splunk/etc and /opt/splunk/etc  see: &lt;A href="https://github.com/splunk/docker-splunk/blob/master/enterprise/Dockerfile"&gt;https://github.com/splunk/docker-splunk/blob/master/enterprise/Dockerfile&lt;/A&gt;. But i cant't figure out what...I don't run splunk when running the image so i don't know how the volumes getting manipulated and also why only the npm install files getting deleted. &lt;/P&gt;

&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
    <pubDate>Tue, 29 May 2018 15:11:54 GMT</pubDate>
    <dc:creator>leb7abt</dc:creator>
    <dc:date>2018-05-29T15:11:54Z</dc:date>
    <item>
      <title>Why is my node_modules folder deleted after docker build?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-node-modules-folder-deleted-after-docker-build/m-p/422399#M74210</link>
      <description>&lt;P&gt;Hi guys! &lt;/P&gt;

&lt;P&gt;I'm currently building a docker container with splunk/universalforwarder:7.0.0-monitor-k8s-logs as base image. During my docker build i install my own node.js and want to add my own scriptedinput scripts. &lt;/P&gt;

&lt;P&gt;my eventhub folder:&lt;/P&gt;

&lt;P&gt;/bin/myscript&lt;BR /&gt;
/bin/package.json&lt;/P&gt;

&lt;P&gt;Dockerfile:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FROM splunk/universalforwarder:7.0.0-monitor-k8s-logs

RUN apt-get update \ 
 &amp;amp;&amp;amp; apt-get install curl -y \
 &amp;amp;&amp;amp; curl -sL &lt;A href="https://deb.nodesource.com/setup_8.x" target="test_blank"&gt;https://deb.nodesource.com/setup_8.x&lt;/A&gt; | bash \
 &amp;amp;&amp;amp; sudo apt-get install -y nodejs 

COPY eventhub  /opt/splunk/etc/apps/eventhub/

WORKDIR /opt/splunk/etc/apps/eventhub/bin/

RUN npm i --production &amp;amp;&amp;amp; ls -al  &amp;lt;==
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;ls -al gives me that all are successfully created:&lt;/P&gt;

&lt;P&gt;myscript&lt;BR /&gt;
node_modules&lt;BR /&gt;
package.json&lt;BR /&gt;
package.json.lock&lt;/P&gt;

&lt;P&gt;However running my new image, the node_modules folder and package.json.lock is missing. After doing a manual npm install in the container everything is working.  &lt;/P&gt;

&lt;P&gt;Copying the files to /opt/splunk/  and doing the npm install there and not to /opt/splunk/etc the files are there. &lt;/P&gt;

&lt;P&gt;I think it has something to do with the base image volumes of /opt/splunk/etc and /opt/splunk/etc  see: &lt;A href="https://github.com/splunk/docker-splunk/blob/master/enterprise/Dockerfile"&gt;https://github.com/splunk/docker-splunk/blob/master/enterprise/Dockerfile&lt;/A&gt;. But i cant't figure out what...I don't run splunk when running the image so i don't know how the volumes getting manipulated and also why only the npm install files getting deleted. &lt;/P&gt;

&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 15:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-node-modules-folder-deleted-after-docker-build/m-p/422399#M74210</guid>
      <dc:creator>leb7abt</dc:creator>
      <dc:date>2018-05-29T15:11:54Z</dc:date>
    </item>
  </channel>
</rss>

