|
| 1 | +ARG UBUNTU_VERSION=22.04 |
| 2 | +ARG LLVM_VERSION=16 |
| 3 | +ARG JULIA_MAJOR_VERSION=8 |
| 4 | +ARG JULIA_MINOR_VERSION=3 |
| 5 | + |
| 6 | +FROM ubuntu:$UBUNTU_VERSION |
| 7 | + |
| 8 | +ARG LLVM_VERSION |
| 9 | +ARG JULIA_MAJOR_VERSION |
| 10 | +ARG JULIA_MINOR_VERSION |
| 11 | + |
| 12 | +ENV DEBIAN_FRONTEND=noninteractive |
| 13 | + |
| 14 | +# Install the base dependencies |
| 15 | +RUN apt-get update && apt-get install -y --no-install-recommends python3 python-is-python3 wget curl lsb-release ca-certificates software-properties-common build-essential gnupg2 python3-pip git pkg-config libssl-dev gcc gfortran |
| 16 | + |
| 17 | +# Can this be converted into a native Ubuntu install as in the LLVM case |
| 18 | +ENV CARGO_HOME="/cargo" |
| 19 | +ENV RUSTUP_HOME="/rustup" |
| 20 | +RUN curl https://sh.rustup.rs | sh -s -- -y --default-toolchain none |
| 21 | +ENV PATH="$PATH:/cargo/bin" |
| 22 | +RUN rustup toolchain install nightly-2023-06-22 \ |
| 23 | + && rustup component add rust-src rustc-dev llvm-tools-preview |
| 24 | + |
| 25 | +# LLVM Installation |
| 26 | +RUN apt-get -q update \ |
| 27 | + && curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - \ |
| 28 | + && apt-add-repository "deb http://apt.llvm.org/`lsb_release -cs`/ llvm-toolchain-`lsb_release -cs`-$LLVM_VERSION main" || true \ |
| 29 | + && apt-get -q update \ |
| 30 | + && apt-get install -y clang-$LLVM_VERSION llvm-$LLVM_VERSION llvm-$LLVM_VERSION-dev \ |
| 31 | + && ln -s /usr/bin/clang-$LLVM_VERSION /usr/bin/clang \ |
| 32 | + && ln -s /usr/bin/clang++-$LLVM_VERSION /usr/bin/clang++ \ |
| 33 | + && ln -s /usr/bin/llvm-objcopy-$LLVM_VERSION /usr/bin/llvm-objcopy |
| 34 | + |
| 35 | +# Install and configure Spack |
| 36 | +ENV SPACK_ROOT=/opt/spack |
| 37 | +ENV PATH=${PATH}:${SPACK_ROOT}/bin |
| 38 | +RUN git clone https://github.com/spack/spack.git ${SPACK_ROOT} \ |
| 39 | + && git --git-dir=${SPACK_ROOT}/.git --work-tree=${SPACK_ROOT} checkout develop \ |
| 40 | + && . ${SPACK_ROOT}/share/spack/setup-env.sh |
| 41 | + |
| 42 | +# Add Spack build cache (AWS) |
| 43 | +ENV FORCE_UNSAFE_CONFIGURE=1 |
| 44 | +RUN spack mirror add binary_mirror https://binaries.spack.io/develop |
| 45 | +RUN spack buildcache keys --install --trust |
| 46 | + |
| 47 | +# Install Julia |
| 48 | +RUN curl \ |
| 49 | + https://julialang-s3.julialang.org/bin/linux/x64/1.$JULIA_MAJOR_VERSION/julia-1.$JULIA_MAJOR_VERSION.$JULIA_MINOR_VERSION-linux-x86_64.tar.gz \ |
| 50 | + | tar -xz |
| 51 | +RUN mv julia-1.$JULIA_MAJOR_VERSION.$JULIA_MINOR_VERSION/ /opt/ |
| 52 | +ENV PATH="/opt/julia-1.$JULIA_MAJOR_VERSION.$JULIA_MINOR_VERSION/bin/:${PATH}" |
| 53 | + |
| 54 | +# Set up the Python dependencies |
| 55 | +COPY Pipfile* ./ |
| 56 | +RUN pip3 install pipenv \ |
| 57 | + && pipenv sync --categories "packages dev-packages" --system \ |
| 58 | + && pipenv --clear \ |
| 59 | + && rm Pipfile* |
| 60 | + |
| 61 | +# Clean up the Docker container to make the image smaller |
| 62 | +RUN apt-get autoremove -y --purge \ |
| 63 | + && apt-get clean -y \ |
| 64 | + && rm -rf /var/lib/apt/lists/* |
| 65 | + |
| 66 | +ENV DEBIAN_FRONTEND= |
0 commit comments