From 52b93a7b94ee1f61377fc026af026e58476fac91 Mon Sep 17 00:00:00 2001 From: Tomas Mirchev Date: Tue, 25 Feb 2025 08:19:34 +0100 Subject: [PATCH] add python image --- python/Dockerfile | 5 +++++ python/README.md | 26 ++++++++++++++++++++++++++ python/install-packages.sh | 19 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 python/Dockerfile create mode 100644 python/README.md create mode 100644 python/install-packages.sh diff --git a/python/Dockerfile b/python/Dockerfile new file mode 100644 index 0000000..0bbc90b --- /dev/null +++ b/python/Dockerfile @@ -0,0 +1,5 @@ +ARG VERSION="latest" +FROM registry.tomastm.com/base-debian:${VERSION} + +COPY install-packages.sh /tmp/install-packages.sh +RUN sudo chmod +x /tmp/install-packages.sh && /tmp/install-packages.sh && sudo rm /tmp/install-packages.sh diff --git a/python/README.md b/python/README.md new file mode 100644 index 0000000..aa9df14 --- /dev/null +++ b/python/README.md @@ -0,0 +1,26 @@ +# Dev containers + +## Commands + +Build +``` +docker build \ + --build-arg UID=$(id -u) \ + --build-arg GID=$(id -g) \ + -t web-stack . +``` + +Run. Mount /workspace if you want to preserve changes. Mount /workspace if you want to preserve changes. +``` +podman run -it --rm \ + --userns=keep-id \ + --network host \ + -v $HOME/.ssh:/home/dev/.ssh:ro,Z \ + -v $PWD:/workspace:Z \ + my-dev-container +``` + +## Installed tools +- Common ones: curl, git, vim, tmux, zsh. Included dotfiles. +- NVM and nodejs (lts, v18, v20, v22). +- All package managers preinstalled (npm, pnpm, yarn). Enable with `corepack enable `. diff --git a/python/install-packages.sh b/python/install-packages.sh new file mode 100644 index 0000000..e1e5f00 --- /dev/null +++ b/python/install-packages.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +sudo apt-get update && sudo apt-get install -y \ + python3-pip python3-venv + +# Install Poetry +curl -sSL https://install.python-poetry.org | python3 - + +# Ensure Poetry is in PATH +export PATH="$HOME/.local/bin:$PATH" + +# Configure Poetry to use in-project virtual environments +poetry config virtualenvs.in-project true + +sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/* + +echo "Poetry and venv installed successfully!"