Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Add run_in_docker.sh to allow repetitive builds #2008

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:20.04

RUN apt update && apt -y install \
build-essential \
clang \
curl \
python3-dev

ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/rust
ENV PATH=$PATH:/opt/rust/bin


COPY scripts/install_build_tools.sh .
RUN bash install_build_tools.sh
16 changes: 16 additions & 0 deletions run_in_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/env bash
set -e

docker_image_name=blockifier-ci
docker build . -t ${docker_image_name}

docker run \
--rm \
--net host \
-e CARGO_HOME=${HOME}/.cargo \
-u $UID \
-v /tmp:/tmp \
-v "${HOME}:${HOME}" \
--workdir ${PWD} \
${docker_image_name} \
"$@"
44 changes: 44 additions & 0 deletions scripts/install_build_tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/env bash
set -e
function install_base_packages () {
apt update && apt -y install \
build-essential \
clang \
curl \
python3-dev
}

function install_pypy() {
pushd /opt
$USE_SUDO bash -c '
curl -Lo pypy3.9-v7.3.11-linux64.tar.bz2 https://downloads.python.org/pypy/pypy3.9-v7.3.11-linux64.tar.bz2
tar -xf pypy3.9-v7.3.11-linux64.tar.bz2
rm pypy3.9-v7.3.11-linux64.tar.bz2
chmod +x pypy3.9-v7.3.11-linux64/bin/pypy3

if [ -L /usr/local/bin/pypy3.9 ]; then
unlink /usr/local/bin/pypy3.9
fi

ln -s /opt/pypy3.9-v7.3.11-linux64/bin/pypy3 /usr/local/bin/pypy3.9

if [ -L /opt/pypy3.9 ]; then
unlink /opt/pypy3.9
fi

ln -s /opt/pypy3.9-v7.3.11-linux64 /opt/pypy3.9
pypy3.9 -m ensurepip
pypy3.9 -m pip install wheel
'
popd
}

function install_rust () {
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
}

# Uncomment only if base packages is not installed via Dockerfile
# install_base_packages
install_pypy &
install_rust &
wait
Loading