oblivion
oblivion

Reputation: 6548

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

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

Upvotes: 6

Views: 8516

Answers (2)

Waldemar Wosiński
Waldemar Wosiński

Reputation: 1580

You may view the docker file generated from plugin: sbt-native-packager. Should improve your initial understanding. For demo read general docker tutorials not sticking to what you want actually run in it.

After sbt docker:publishLocal you'll get image name and a dockerfile in target folder. You may run the image with docker run -i MY_NAME.

Upvotes: 0

VonC
VonC

Reputation: 1324935

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"]

Upvotes: 7

Related Questions