FROM            ubuntu:16.04
MAINTAINER      MIT Probabilistic Computing Project

RUN             apt-get update -qq && apt-get install -qq \
                        build-essential \
                        wget \
                        ; # end of packages

RUN             mkdir /julia
RUN             mkdir /julia/gpghome

RUN             cd /julia && \
    wget https://julialang.org/juliareleases.asc && \
    { echo a27705bf1e5a44d1905e669da0c990ac2d7ab7c13ec299e15bacdab5dcbb8d13 juliareleases.asc | sha256sum -c; }
RUN             cd /julia && gpg --homedir gpghome --import juliareleases.asc

ENV             JULIA_TGZ=julia-0.7.0-linux-x86_64.tar.gz
ENV             JULIA_URL=https://julialang-s3.julialang.org/bin/linux/x64/0.7
RUN             cd /julia && \
    wget "$JULIA_URL/$JULIA_TGZ" "$JULIA_URL/$JULIA_TGZ.asc" && \
    gpg --homedir gpghome --verify "$JULIA_TGZ.asc" "$JULIA_TGZ"
RUN             cd /julia && \
     gunzip -c < "$JULIA_TGZ" | tar -x -f - --strip-components 1
ENV             PATH="$PATH:/julia/bin"

ADD             . /probcomp/Gen

RUN             julia -e 'using Pkg; Pkg.develop(PackageSpec(path="/probcomp/Gen"))'
RUN				julia -e 'Pkg.test("Gen")'

RUN             julia -e 'Pkg.add("FunctionalCollections")'
RUN             julia -e 'Pkg.add("Distributions")'
RUN             julia -e 'include("/probcomp/Gen/examples/run_examples.jl")'
