Skip to content

Commit

Permalink
docker
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-d committed Feb 7, 2024
1 parent 8a080a5 commit fab99dc
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 10 deletions.
64 changes: 64 additions & 0 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
12 changes: 8 additions & 4 deletions scripts/allpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -euo pipefail

script_dir=$(realpath $(dirname $0))

mkdir -p /opt/python

i()
{
local v=$1
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions scripts/debian-packages.txt

This file was deleted.

0 comments on commit fab99dc

Please sign in to comment.