From fab99dc00132ffd6d5c78f798d70071bed886697 Mon Sep 17 00:00:00 2001 From: rene-d Date: Wed, 7 Feb 2024 09:18:02 +0100 Subject: [PATCH] docker --- scripts/Dockerfile | 64 +++++++++++++++++++++++++++++++++++++ scripts/allpython.sh | 12 ++++--- scripts/debian-packages.txt | 6 ---- 3 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 scripts/Dockerfile delete mode 100644 scripts/debian-packages.txt diff --git a/scripts/Dockerfile b/scripts/Dockerfile new file mode 100644 index 0000000..a1e67d2 --- /dev/null +++ b/scripts/Dockerfile @@ -0,0 +1,64 @@ +FROM debian:bookworm + +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y vim curl wget sudo + +RUN apt-get install -y build-essential cmake gdb +RUN apt-get install -y python3-full python3-dev +RUN apt-get install -y clang llvm + + +# deps for puzzles +RUN apt-get install -y z3 + +# to compile Python 3.x +RUN apt-get install -y libssl-dev liblzma-dev + +# seems to be mandatory to compile Python 3.13 +RUN apt-get install -y libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev + +# dep for pip install shapely (if building from sources is needed) +RUN apt-get install -y libgeos-dev + + +ENV CARGO_HOME /usr/local/cargo +ENV RUSTUP_HOME /usr/local/rustup +ENV PATH "/usr/local/cargo/bin:$PATH" + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ + rustup component add rust-src + + + + +RUN curl -sL https://downloads.python.org/pypy/pypy3.10-v7.3.15-linux64.tar.bz2 | tar -C /opt -xj +RUN /opt/pypy3.10-v7.3.15-linux64/bin/pypy3 -mensurepip + + +COPY allpython.sh / +RUN /allpython.sh + +COPY requirements.txt / +RUN /opt/python/Python-3.10.13/bin/python3.10 -mvenv /venv/py3.10 +RUN /opt/python/Python-3.11.7/bin/python3.11 -mvenv /venv/py3.11 +RUN /opt/python/Python-3.12.1/bin/python3.12 -mvenv /venv/py3.12 +RUN /opt/python/Python-3.13.0a3/bin/python3.13 -mvenv /venv/py3.13 +RUN /opt/pypy3.10-v7.3.15-linux64/bin/pypy3.10 -mvenv /venv/pypy3.10 + +RUN echo 'alias ll="ls -l --color"' >> /etc/bash.bashrc + +ARG HOST_U=1027 +ARG HOST_G=100 +ARG HOST_UN=user +RUN useradd --create-home --no-user-group -g $HOST_G -u $HOST_U $HOST_UN +RUN echo "$HOST_UN ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN echo 'export SHELL=/bin/bash' >> /etc/bash.bashrc +RUN chmod 777 /usr/local/cargo + + +# WORKDIR /advent-of-rust +# RUN curl -sfL https://github.com/rene-d/advent-of-rust/tarball/refs/heads/main | tar -xz --strip-components=1 +# RUN ln -s /venv .venv +# RUN ln -s /data data +# VOLUME /data diff --git a/scripts/allpython.sh b/scripts/allpython.sh index d20f234..fe88ebd 100755 --- a/scripts/allpython.sh +++ b/scripts/allpython.sh @@ -4,6 +4,8 @@ set -euo pipefail script_dir=$(realpath $(dirname $0)) +mkdir -p /opt/python + i() { local v=$1 @@ -15,22 +17,24 @@ i() rm -rf /tmp/Python-$v /opt/python/Python-$v curl -sL $url | tar -C /tmp -xJ cd /tmp/Python-$v - ./configure --prefix=/opt/python/Python-$v --enable-optimizations --disable-test-modules + ./configure --prefix=/opt/python/Python-$v --enable-optimizations make -j$(nproc --ignore=1) make altinstall # /opt/python/Python-$v/bin/python$m -mensurepip cd /tmp rm -rf /tmp/Python-$v - $script_dir/runall.py --venv /opt/python/Python-$v/bin/python$m + if [ -f $script_dir/runall.py ] ; then + $script_dir/runall.py --venv /opt/python/Python-$v/bin/python$m + fi } a() { i 3.10.13 - i 3.11.6 + i 3.11.7 i 3.12.1 - # i 3.13.0a3 + i 3.13.0a3 } if [ ${1-} ]; then diff --git a/scripts/debian-packages.txt b/scripts/debian-packages.txt deleted file mode 100644 index 8af296b..0000000 --- a/scripts/debian-packages.txt +++ /dev/null @@ -1,6 +0,0 @@ -clang -llvm -z3 -libgeos-dev -libssl-dev -libbz2-dev