title: sh on docker: syntax error: unexpected end of file (expecting "then")
body: <p>I am running the startup.sh script from Dockerfile and I get the error below when I run the docker container:</p>
  
  <pre><code>docker run -p 5308:5308 activity-logger
  : not found line 2:
  : not found line 5:
  startup.sh: line 13: syntax error: unexpected end of file (expecting "then")
  </code></pre>
  
  <p>If I try to run <code>sh startup.sh</code> from my command line it seems to work well.
  Any ideas?</p>
  
  <p><strong>startup.sh</strong></p>
  
  <pre><code>#!/bin/sh
  
  export env_file=`echo microservice-configuration/$LS_ENVIRONMENT.environment.properties`
  export startup_command="npm run start:dist"
  
  if [ -f $env_file ]; then
    echo "Using environment specific configuration file $env_file"
    env $(cat $env_file | xargs) $startup_command
  else
    echo "There is no environment specific configuration file $env_file"
    $startup_command
  fi
  </code></pre>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM node:6.9.4-alpine
  
  # Create app directory
  RUN mkdir -p /opt/app
  WORKDIR /opt/app
  COPY . /opt/app
  
  RUN npm install -g yarn
  RUN yarn
  RUN yarn build
  # This is not working very well - the dependencies cannot be installed afterwards
  # RUN yarn --production
  
  ENV NODE_ENV production
  
  EXPOSE 5308
  
  CMD ["/bin/sh", "startup.sh"]
  </code></pre>