docker-black
docker-black copied to clipboard
Alpine-based multistage-build version of Python Black for reproducible usage in CI
Docker image for black
All #awesome-ci Docker images
ansible-lint • ansible • awesome-ci • bandit • black • checkmake • eslint • file-lint • gofmt • goimports • golint • jsonlint • kubeval • linkcheck • mypy • php-cs-fixer • phpcbf • phpcs • phplint • pycodestyle • pydocstyle • pylint • terraform-docs • terragrunt-fmt • terragrunt • yamlfmt • yamllint
View Dockerfiles on GitHub.
Available Architectures: amd64
, i386
, arm64
, arm/v7
, arm/v6
, ppc64le
, s390x
Tiny Alpine-based multistage-build dockerized version of Black[1]. The image is built nightly against multiple stable versions and pushed to Dockerhub.
[1] Official project: https://github.com/python/black
:octocat: GitHub Action
Runs on:
To add this to GitHub Actions, add the following snippet into your .github/workflows/
directory:
.github/workflows/lint.yml
on: [push, pull_request]
jobs:
python-black:
name: Python Black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Python Black
uses: cytopia/[email protected]
with:
path: 'src/'
:whale: Available Docker image versions
Rolling releaess
The following Docker image tags are rolling releases and are built and updated every night.
Docker Tag | Git Ref | Black | Python | Available Architectures |
---|---|---|---|---|
latest |
master | latest | latest | amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.10 |
master | latest | 3.10 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.9 |
master | latest | 3.9 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.8 |
master | latest | 3.8 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.7 |
master | latest | 3.7 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.6 |
master | latest | 3.6 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22 |
master | 22.x.x |
latest | amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.10 |
master | 22.x.x |
3.10 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.9 |
master | 22.x.x |
3.9 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.8 |
master | 22.x.x |
3.8 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.7 |
master | 22.x.x |
3.7 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.6 |
master | 22.x.x |
3.6 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
Point in time releases
The following Docker image tags are built once and can be used for reproducible builds. Its version never changes so you will have to update tags in your pipelines from time to time in order to stay up-to-date.
Docker Tag | Git Ref | Black | Python | Available Architectures |
---|---|---|---|---|
latest-<tag> |
git: <tag> |
latest | latest | amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.10-<tag> |
git: <tag> |
latest | 3.10 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.9-<tag> |
git: <tag> |
latest | 3.9 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.8-<tag> |
git: <tag> |
latest | 3.8 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.7-<tag> |
git: <tag> |
latest | 3.7 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
latest-py3.6-<tag> |
git: <tag> |
latest | 3.6 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-<tag> |
git: <tag> |
22.x.x |
latest | amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.10-<tag> |
git: <tag> |
22.x.x |
3.10 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.9-<tag> |
git: <tag> |
22.x.x |
3.9 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.8-<tag> |
git: <tag> |
22.x.x |
3.8 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.7-<tag> |
git: <tag> |
22.x.x |
3.7 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
22-py3.6-<tag> |
git: <tag> |
22.x.x |
3.6 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
Where
<tag>
refers to the chosen git tag from this repository.
:open_file_folder: Docker mounts
The working directory inside the Docker container is /data/
and should be mounted locally.
:computer: Usage
Command line
# Linux, Mac, Windows (Powershell)
docker run --rm -v $(pwd):/data cytopia/black main.py
# Windows (cmd)
docker run --rm -v %cd%:/data cytopia/black main.py
GitLab CI
stages:
- format
format-black:
stage: format
image:
name: cytopia/black
entrypoint: ["/bin/ash", "-c"]
script:
- python3 -m black --check --diff my_source_files/
:arrows_counterclockwise: Related #awesome-ci projects
Docker images
Save yourself from installing lot's of dependencies and pick a dockerized version of your favourite linter below for reproducible local or remote CI tests:
GitHub | DockerHub | Type | Description |
---|---|---|---|
awesome-ci | Basic | Tools for git, file and static source code analysis | |
file-lint | Basic | Baisc source code analysis | |
linkcheck | Basic | Search for URLs in files and validate their HTTP status code | |
ansible | Ansible | Multiple versions and flavours of Ansible | |
ansible-lint | Ansible | Lint Ansible | |
gofmt | Go | Format Go source code [1] | |
goimports | Go | Format Go source code [1] | |
golint | Go | Lint Go code | |
eslint | Javascript | Lint Javascript code | |
jsonlint | JSON | Lint JSON files [1] | |
kubeval | K8s | Lint Kubernetes files | |
checkmake | Make | Lint Makefiles | |
phpcbf | PHP | PHP Code Beautifier and Fixer | |
phpcs | PHP | PHP Code Sniffer | |
phplint | PHP | PHP Code Linter [1] | |
php-cs-fixer | PHP | PHP Coding Standards Fixer | |
bandit | Python | A security linter from PyCQA | |
black | Python | The uncompromising Python code formatter | |
mypy | Python | Static source code analysis | |
pycodestyle | Python | Python style guide checker | |
pydocstyle | Python | Python docstyle checker | |
pylint | Python | Python source code, bug and quality checker | |
terraform-docs | Terraform | Terraform doc generator (TF 0.12 ready) [1] | |
terragrunt | Terraform | Terragrunt and Terraform | |
terragrunt-fmt | Terraform | terraform fmt for Terragrunt files [1] |
|
yamlfmt | Yaml | Format Yaml files [1] | |
yamllint | Yaml | Lint Yaml files |
[1] Uses a shell wrapper to add enhanced functionality not available by original project.
Makefiles
Visit cytopia/makefiles for dependency-less, seamless project integration and minimum required best-practice code linting for CI. The provided Makefiles will only require GNU Make and Docker itself removing the need to install anything else.
:page_facing_up: License
MIT License
Copyright (c) 2019 cytopia