Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to write a dockerfile to run a sbt project in container

Tags:

docker

sbt

I want to write a dockerfile manually without using any sbt plugins. I am using sbt 0.13.8. I looked at dockerfile reference but could not get enough insights for my requirement. A demo would be extremely helpful

like image 882
oblivion Avatar asked Dec 21 '15 03:12

oblivion


People also ask

How do I run a container in Dockerfile?

To do so, you will use the docker run command. You use the -d flag to run the new container in “detached” mode (in the background). You also use the -p flag to create a mapping between the host's port 3000 to the container's port 3000. Without the port mapping, you wouldn't be able to access the application.


1 Answers

If you mean write a Dockerfile producing an image able to run an sbt project, you can take a look at William-Yeh/docker-sbt:

# Sbt on Java 7
#
# URL: https://github.com/William-Yeh/docker-sbt
#
# @see http://www.scala-sbt.org/release/tutorial/Manual-Installation.html
#
# Version     0.7

FROM williamyeh/java7
MAINTAINER William Yeh <[email protected]>


ENV SBT_VERSION  0.13.8
ENV SBT_JAR      https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$SBT_VERSION/sbt-launch.jar


ADD  $SBT_JAR  /usr/local/bin/sbt-launch.jar  
COPY sbt.sh    /usr/local/bin/sbt

RUN echo "==> fetch all sbt jars from Maven repo..."       && \
    echo "==> [CAUTION] this may take several minutes!!!"  && \
    sbt


VOLUME [ "/app" ]
WORKDIR /app


# Define default command.
ENTRYPOINT ["sbt"]
CMD ["--version"]
like image 75
VonC Avatar answered Sep 19 '22 13:09

VonC