title: Jenkins: Creating pipeline to read dockerfile
body: <p>Creating a Pipeline to read a Dockerfile and create container for this app be run.</p>
  <p>Jenkinsfile:</p>
  <pre><code>pipeline {
    agent any
    tools {nodejs &quot;node&quot; }
    stages {
      stage('Cloning Git') {
        steps {
          git url: 'https://github.com/user/private-repo.git',
          credentialsId: 'Git-2'
        }
      }
      stage('Build Container Image') {
        steps {
          agent{
            dockerfile {
                filename '$workspace/Dockerfile',
                label 'node'              
            }
          }
        }
      }
      stage('Build') {
         steps {
           sh 'npm install'
         }
      }
      stage('Test') {
        steps {
          sh &quot;pwd&quot;
        }
      }    
    }
  }
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <p>WorkflowScript: 15: Expected a step @ line 15, column 15.
  filename '$workspace/Dockerfile',</p>
  </blockquote>
  <p>I was reading this article <a href="https://www.jenkins.io/doc/book/pipeline/docker/" rel="nofollow noreferrer">Using Docker with Pipeline</a>. I new in Jenkins and in my mind, I was thinking in this steps:</p>
  <ul>
  <li>Clone Repo</li>
  <li>Read Dockerfile</li>
  <li>Run Container abd Bind Workspace Jenkins to Container Workspace</li>
  <li>Install NPM Packages</li>
  <li>Run Application</li>
  </ul>
  <p>But as I don't know how to deal with Jenkins I'm kind lost here.</p>
  <p>Dockerfile:</p>
  <pre><code>FROM node
  
  RUN apt-get update &amp;&amp; apt-get upgrade -y \
      &amp;&amp; apt-get clean
  
  RUN mkdir /app
  WORKDIR /app
  
  COPY package*.json /app/
  
  RUN npm install
  
  COPY src /app/src
  
  EXPOSE 3000
  
  CMD [ &quot;npm&quot;, &quot;start&quot; ]
  </code></pre>
  <p>Anyone can please help me, or suggest an article?</p>
  <h2>Jenkins works in my thoughts</h2>
  <p><a href="https://i.stack.imgur.com/yFxGC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yFxGC.png" alt="enter image description here" /></a></p>