FROM java:8

RUN mkdir /opt/app  && \
  mkdir /opt/src

ENV SCALA_VERSION 2.11.7
ENV SBT_VERSION 0.13.8

# Install Scala
RUN \
  cd /root && \
  curl -o scala-$SCALA_VERSION.tgz http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz && \
  tar -xf scala-$SCALA_VERSION.tgz && \
  rm scala-$SCALA_VERSION.tgz && \
  echo >> /root/.bashrc && \
  echo 'export PATH=~/scala-$SCALA_VERSION/bin:$PATH' >> /root/.bashrc

# Install sbt
RUN \
  curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb && \
  dpkg -i sbt-$SBT_VERSION.deb && \
  rm sbt-$SBT_VERSION.deb && \
  apt-get update && \
  apt-get install sbt && \
  sbt version

ADD . /opt/app/

RUN \
  cd /opt/app && \
  sbt compile

RUN echo '<%= start %>' > /opt/start && \
  chmod +x /opt/start

RUN echo <%= sha %> > /opt/app/sha

CMD /opt/start

FROM java:8

RUN mkdir /opt/app && \
  mkdir /opt/src

ENV SCALA_VERSION 2.11.7
ENV SBT_VERSION 0.13.8

# Install Scala
RUN \
  cd /root && \
  curl -o scala-$SCALA_VERSION.tgz http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz && \
  tar -xf scala-$SCALA_VERSION.tgz && \
  rm scala-$SCALA_VERSION.tgz && \
  echo >> /root/.bashrc && \
  echo 'export PATH=~/scala-$SCALA_VERSION/bin:$PATH' >> /root/.bashrc

# Install sbt
RUN \
  curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb && \
  dpkg -i sbt-$SBT_VERSION.deb && \
  rm sbt-$SBT_VERSION.deb && \
  apt-get update && \
  apt-get install sbt && \
  sbt version

ADD . /opt/app/

RUN \
  cd /opt/app && \
  sbt compile

RUN echo '<%= start %>' > /opt/start && \
  chmod +x /opt/start

RUN echo <%= sha %> > /opt/app/sha

CMD /opt/start

Remove space from sbt dockerfile
Remove space from sbt dockerfile
