title: Building a Docker image for a Node.js app in GitLab CI
body: <p>I'm working on a Node.js application for which my current <code>Dockerfile</code> looks like this: </p>
  
  <pre><code># Stage 0
  # =======
  FROM node:10-alpine as build-stage
  
  WORKDIR /app
  
  COPY package.json yarn.lock ./
  RUN yarn install
  
  COPY . ./
  RUN yarn build
  
  # Stage 1
  # =======
  FROM nginx:mainline-alpine
  
  COPY --from=build-stage /app/build /usr/share/nginx/html
  </code></pre>
  
  <p>I'd like to integrate this into a GitLab CI pipeline but I'm not sure if I got the basic idea. So far I know that I need to create a <code>.gitlab-ci.yml</code> file which will be later picked up by GitLab.</p>
  
  <p>My basic idea is:</p>
  
  <ol>
  <li>I push my code changes to GitLab.</li>
  <li>GitLab builds a new Docker image based on my <code>Dockerfile</code>.</li>
  <li>GitLab pushes this newly create image to a "production" server (later).</li>
  </ol>
  
  <p>So, my question is:<br>
  My <code>.gitlab-ci.yml</code> should then contain something like a <code>build</code> job which triggers... what? The <code>docker build</code> command? Or do I need to "copy" the <code>Dockerfile</code> content to the CI file?</p>