New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerfile to ease development. #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
FROM ubuntu:16.04 | ||
|
||
MAINTAINER andrea peruffo <andrea.peruffo1982@gmail.com> | ||
|
||
# --- --- --- Proxy Settings --- --- --- | ||
#UNCOMMENT IF BHEIND A PROXY | ||
#SET A PROPER PROXY IP | ||
|
||
#ENV DOCKER_PROXY PROXY_IP | ||
|
||
#ENV http_proxy ${DOCKER_PROXY} | ||
#ENV HTTP_PROXY ${DOCKER_PROXY} | ||
#ENV https_proxy ${DOCKER_PROXY} | ||
#ENV HTTPS_PROXY ${DOCKER_PROXY} | ||
#ENV NO_PROXY '127.0.0.1, localhost, /var/run/docker.sock' | ||
|
||
ENV SCALA_VERSION 2.11.8 | ||
ENV SBT_VERSION 0.13.11 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
wget tar curl git \ | ||
openjdk-8-jdk \ | ||
clang++-3.7 llvm-3.7 llvm-3.7-dev llvm-3.7-runtime llvm-3.7-tool \ | ||
libgc-dev | ||
|
||
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk | ||
|
||
RUN \ | ||
curl -fsL http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \ | ||
echo >> /root/.bashrc && \ | ||
echo 'export PATH=~/scala-$SCALA_VERSION/bin:$PATH' >> /root/.bashrc | ||
|
||
RUN \ | ||
curl -L -o sbt-$SBT_VERSION.deb http://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb && \ | ||
dpkg -i sbt-$SBT_VERSION.deb && \ | ||
rm sbt-$SBT_VERSION.deb | ||
|
||
RUN apt-get update && \ | ||
apt-get -y install sbt | ||
|
||
WORKDIR /tmp | ||
|
||
RUN git clone https://github.com/scala-native/scala-native.git | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why you clone the repo here instead of ADDing it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed to let Docker cache most of the build dependencies at build time (takes soooooooo long) |
||
|
||
WORKDIR /tmp/scala-native/submodules | ||
|
||
RUN rm -rf scala && git clone https://github.com/scala/scala.git | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this clone required? It should certainly have some There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably here one can fix adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for putting this Dockerfile together! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cheers! :-) |
||
|
||
WORKDIR /tmp/scala-native | ||
|
||
RUN ln -s /usr/bin/clang++-3.7 /usr/bin/clang++ | ||
RUN sed -i 's|__stdoutp|stdout|;s|__stderrp|stderr|' demo-native/smallpt.scala nativelib/src/main/scala/scala/scalanative/native/stdlib.scala | ||
|
||
RUN sbt 'rtlib/publishLocal' && sbt 'nscplugin/publishLocal' | ||
|
||
WORKDIR /home/sources | ||
|
||
CMD ["/bin/bash"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCALANATIVE_DOCKER_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
SCALANATIVE_HOME_PATH=$SCALANATIVE_DOCKER_PATH/../ | ||
|
||
case "$1" in | ||
build) | ||
docker -D build -t="ubuntu-scalanative:latest" . | ||
;; | ||
run) | ||
#remember to start nvidia-docker-plugin | ||
docker run --rm -i -v $SCALANATIVE_HOME_PATH:/home/sources:rw -t "ubuntu-scalanative:latest" | ||
;; | ||
*) | ||
echo "Usage [ build, run ] " | ||
exit 0 | ||
;; | ||
esac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to use ubuntu over alpine?
Also, you should really glue up all these RUN statements together, the cleanup needs to happen in the same command (e.g. you could remove the build deps that aren't required later). This entire file could be rewritten using a single RUN command.
Doing that would make this docker file much much smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ubuntu over alpine because this is intended to be a development environment and not a deploy one.
Going to polish a bit the commands to make it smaller.