Skip to content

Commit d5e0f49

Browse files
Create new directory & Dockerfile for standalone Dockerfile. (llvm-ml#17)
* Create new Dockerfile for standalone Dockerfile. * Add missing Pipfile lock. * Change rust default installation directory Currently the default installation directory is in the user's home directory which doesn't work with singularity. This sets it to two top-level directories. * Add Dockerfile * Fix error in Julia installation. --------- Co-authored-by: Aiden Grossman <[email protected]>
1 parent d6901df commit d5e0f49

File tree

4 files changed

+1112
-1
lines changed

4 files changed

+1112
-1
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
__pycache__
2-
Pipfile.lock

.packaging/Dockerfile

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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=

.packaging/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Packaging
2+
3+
This directory contains utilities to package the project along with relevant
4+
dependencies and toolchains to build the dataset.
5+
6+
### Building the Docker Image
7+
8+
To build the Docker image, run the following command from the root of the
9+
repository:
10+
11+
```bash
12+
docker build -t llvm-ir-dataset-utils -f ./.packaging/Dockerfile .
13+
```

0 commit comments

Comments
 (0)