Giter Club home page Giter Club logo

dockfmt's Introduction

dockfmt

Travis CI GoDoc

Dockerfile format.

NOTE: This is a work in progress so calm yourself if you want to file 80 bajillion issues.

Table of Contents

Installation

Binaries

For installation instructions from binaries please visit the Releases Page.

Via Go

$ go get github.com/jessfraz/dockfmt

Usage

$ dockfmt -h
dockfmt -  Dockerfile format.

Usage: dockfmt <command>

Flags:

  -d, --debug  enable debug logging (default: false)

Commands:

  base        List the base image used in the Dockerfile(s).
  dump        Dump parsed Dockerfile(s).
  fmt         Format the Dockerfile(s).
  maintainer  List the maintainer for the Dockerfile(s).
  version     Show the version information.

Format

Get help

$ dockfmt fmt -h
Usage: dockfmt fmt [OPTIONS] DOCKERFILE [DOCKERFILE...]

Format the Dockerfile(s).

Flags:

  -D, --diff   display diffs instead of rewriting files (default: false)
  -d, --debug  enable debug logging (default: false)
  -l, --list   list files whose formatting differs from dockfmt's (default: false)
  -w, --write  write result to (source) file instead of stdout (default: false)

Get a diff

$ dockfmt format -d htop/Dockerfile
diff htop/Dockerfile dockfmt/htop/Dockerfile
--- /tmp/dockfmt143910590	2016-09-19 15:59:22.612250710 -0700
+++ /tmp/dockfmt412224773	2016-09-19 15:59:22.612250710 -0700
@@ -4,10 +4,11 @@
 # 	--pid host \
 # 	jess/htop
 #
-FROM alpine:latest
-MAINTAINER Jessie Frazelle <[email protected]>
+
+FROM	alpine:latest
+MAINTAINER	Jessie Frazelle <[email protected]>

-RUN apk --no-cache add \
+RUN	apk add --no-cache \
 	htop

-CMD [ "htop" ]
+CMD	["htop"]

List multiple files with different output

$ dockfmt fmt -l */Dockerfile */*/Dockerfile
ab/Dockerfile
afterthedeadline/Dockerfile
android-tools/Dockerfile
ansible/Dockerfile
apt-file/Dockerfile
atom/Dockerfile
audacity/Dockerfile
awscli/Dockerfile
beeswithmachineguns/Dockerfile
buttslock/Dockerfile
camlistore/Dockerfile
cathode/Dockerfile
...

Base image inspection

$ dockfmt base */Dockerfile */*/Dockerfile
BASE                          COUNT
debian:stretch                50
alpine:latest                 30
debian:sid                    28
ubuntu:16.04                  12
alpine:edge                   7
python:2-alpine               3
ruby:alpine                   2
java:7-alpine                 2
r.j3ss.co/wine                1
kalilinux/kali-linux-docker   1
haskell                       1
mhart/alpine-node:5           1
r.j3ss.co/cpuminer            1
opensuse                      1
java:8-alpine                 1
golang:latest                 1

Maintainer inspection

$ dockfmt maintainer */Dockerfile */*/Dockerfile
MAINTAINER                                      COUNT
Jessie Frazelle <[email protected]>                113
Christian Koep <[email protected]>      11
Justin Garrison <[email protected]>   2
Daniel Romero <[email protected]>             1
Cris G [email protected]                         1

dockfmt's People

Contributors

jeffxf avatar jessfraz avatar jimen0 avatar toc-me[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.