Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 2.52 KB

File metadata and controls

94 lines (65 loc) · 2.52 KB

Python base image for development purpose

Specially created Docker image for Python to work as a devcontainer for development purposes.

NOTE: This image is NOT meant to be used as a production image.

Contains

It contains:

  • uv - for Python package management
  • python - Python version that is defined in .python-version file in the child image.

It contains the necessary dependencies for running various linters and type checkers:

  • watchman - for running Pyre Python type checker
  • shfmt - for shell script formatting
  • shellcheck - for shell script linting
  • reviewdog - for code review
  • hadolint - for linting Dockerfile
  • actionlint - static checker for GitHub Actions workflow files
  • taplo - TOML formatter and linter

Alternative unix power tools:

  • rg (ripgrep) - better alternative to grep
  • fd - better alternative to find
  • btop - better alternative to top/htop
  • eza - better alternative to ls (symlinked to replace ls)
  • dust - better alternative to du
  • bat - better alternative to cat
  • delta - better diff pager for git, diff, grep,...
  • fzf - fuzzy finder
  • tokei - code counter
  • hyperfine - benchmarking tool

Usage

We host the image on Github packages.

You can use it the like this:

As a standalone image

Command line:

docker run --rm ghcr.io/nextgencontributions/python-dev-image

As a base image

In your project's Dockerfile:

FROM ghcr.io/nextgencontributions/python-dev-image # AS scratch

# Do your own customizations here...

NOTE: When using this as a base image, you should have the following files available in your build context:

  • pyproject.toml
  • uv.lock
  • .python-version - this will be used to install the Python version in the container.

If you don't have these files, you can create them by running the following commands:

uv init
uv lock
uv python pin 3.12 # or replace with any other Python version you want

Or in a single command in your project's root directory:

docker run --rm -v $(pwd):/app ghcr.io/nextgencontributions/python-dev-image \
    sh -c "cd /app && uv init && uv lock && uv python pin 3.12"

As a devcontainer

With VSCode in .devcontainer/devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json.
{
    "name": "Python 3",
    "image": "ghcr.io/nextgencontributions/python-dev-image"
    // Do your own customizations here...
}