Skip to content

Instantly share code, notes, and snippets.

@LupusMichaelis
Last active April 3, 2024 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LupusMichaelis/429f9a3bf61cb7493d9a1226ff1c14da to your computer and use it in GitHub Desktop.
Save LupusMichaelis/429f9a3bf61cb7493d9a1226ff1c14da to your computer and use it in GitHub Desktop.
A Debian Bullseye image with Rust and Python built from sources
# syntax=docker/dockerfile:1.5.1
FROM debian:bullseye-slim as python-builder
SHELL [ "/bin/bash", "-euo", "pipefail", "-c" ]
RUN <<eos
declare -ar packages=(
build-essential
gdb
git
lcov
libbz2-dev
libffi-dev
libgdbm-compat-dev
libgdbm-dev
liblzma-dev
libncurses5-dev
libreadline6-dev
libsqlite3-dev
libssl-dev
lzma
lzma-dev
make
pkg-config
python3
tk-dev
uuid-dev
zlib1g-dev
)
apt-get update -yqq
apt-get install -yqq ${packages[@]}
git clone --depth 1 https://github.com/python/cpython.git --branch 3.11
cd cpython
./configure --prefix=/opt/python311
make -j16
make install
cd ..
declare -ar clean_up_dirs=(
cpython
/var/cache/apt/pkgcache.bin
/var/cache/apt/srcpkgcache.bin
/var/cache/apt/archives/partial/*
/var/cache/apt/archives/*
)
rm -rf ${clean_up_dirs[@]}
eos
FROM rust:1.71.0-slim-bullseye
COPY --from=python-builder /opt/python311 /opt/python311/
ENV PATH "$PATH:/opt/python311/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment