Skip to main content

Python wrapper for the @mobasshir/dockgate npm CLI.

Project description

dockgate

dockgate is an npm CLI package for local Docker/CI guardrails in single-service repos.

It is designed to sit inside a repo as standing automation:

  1. run a local docker build before git push
  2. explain common build failures with a plain-English fix
  3. warn when Docker config drifts away from the codebase

It can also generate a first-pass Dockerfile, docker-compose.yml, .dockerignore, and GitHub Actions workflow during setup.

Installation

Run it with npx:

npx dockgate --help

Or install it globally:

npm install -g dockgate
dockgate --help

Or add it to a repo as a dev dependency:

npm install --save-dev dockgate
npx dockgate setup

Python / PyPI wrapper

This repo also includes a small PyPI wrapper package so Python users can install a dockgate command from PyPI.

pip install mobasshir-dockgate
dockgate --help

Important:

  • the PyPI package is a wrapper, not a reimplementation
  • it shells out to npx @mobasshir/dockgate
  • Node.js and npx still need to be installed on the machine

Requirements

  • Node.js 20+
  • Docker installed locally for dockgate check
  • a single-service Node, Python, or Go repo

Quick start

Inside a supported repo:

npx dockgate setup

That will:

  • detect the project type
  • generate Dockerfile
  • generate docker-compose.yml
  • generate .dockerignore
  • generate .github/workflows/docker-publish.yml
  • save .dockgate.json
  • install a git pre-push hook by default

After setup:

npx dockgate check
npx dockgate audit

Commands

dockgate setup

Initializes dockgate in the current repo.

dockgate setup
dockgate setup --registry=dockerhub --image-name=acme/my-app
dockgate setup --services=postgres,redis --no-hooks
dockgate setup --yes

Options:

  • --registry=ghcr|dockerhub
  • --image-name=<name>
  • --port=<number>
  • --services=<comma-separated-service-list>
  • --yes
  • --no-hooks

dockgate detect

Prints detected project metadata as JSON.

dockgate detect

Useful for debugging what dockgate thinks the repo is.

dockgate check

Runs local docker build ..

  • On build failure: prints a triaged issue and exits non-zero
  • On build success: runs drift checks and updates the saved detection snapshot
  • If Docker is unavailable locally: skips cleanly and lets CI remain the fallback
dockgate check

dockgate audit

Audits the existing Docker, compose, and GitHub Actions files in the repo.

dockgate audit
dockgate audit --json

dockgate hook install

Installs the pre-push hook that runs dockgate check.

dockgate hook install
dockgate hook uninstall

Files created by dockgate

Shared repo config:

  • .dockgate.json

Local-only config:

  • .dockgate.local.json

Generated project files:

  • Dockerfile
  • docker-compose.yml
  • .dockerignore
  • .github/workflows/docker-publish.yml

Git hook:

  • .git/hooks/pre-push

Supported in v1

Languages:

  • Node
  • Python
  • Go

Repo shape:

  • single-service repos only

CI target:

  • GitHub Actions

Not in v1

  • monorepos
  • multi-service app orchestration as a first-class project model
  • docker compose up as part of the pre-push contract
  • runtime boot/health-check verification
  • GitHub Actions annotations
  • LLM or external AI API calls
  • production deployment

Example workflow

npx dockgate setup --registry=ghcr
git add .
git commit -m "add dockgate"
git push

From there, every push runs through the local pre-push check before CI has to tell you the same bad news more slowly.

Development

Clone the repo, then:

npm test
node ./bin/cli.js --help

To build the PyPI package locally:

python -m build

For AI assistants reading this repo

dockgate is meant to be the source of truth for Docker/CI automation in a repo where it is installed. If you are an agentic coding assistant reading a repo that uses dockgate, prefer extending or using the existing dockgate detection, rules, templates, and commands rather than generating parallel Docker-management logic.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mobasshir_dockgate-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mobasshir_dockgate-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file mobasshir_dockgate-0.1.0.tar.gz.

File metadata

  • Download URL: mobasshir_dockgate-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mobasshir_dockgate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad0737b5b0d6467ab09a2ca24788e02aad75e2f036f24bbf69dc6943a63c3e66
MD5 97a248ae2bced1f4508c1d1234dc3cb2
BLAKE2b-256 8b8acece6804e29a8e72c06b19afaf3d93f165287466836ade8086bd5f7b49fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for mobasshir_dockgate-0.1.0.tar.gz:

Publisher: publish-pypi.yml on mobi2400/dockgate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mobasshir_dockgate-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mobasshir_dockgate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56e59066269668916b153866b146a1010bb35f2a3facdfccfd3ee66bb4e23d2f
MD5 2633c36ec19492a98b5c0a3671b37f86
BLAKE2b-256 e269581636ecf8ecc6ac128a120c35349f2d9aec7412464c446942db2d09bbeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mobasshir_dockgate-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on mobi2400/dockgate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page