v0.3.0
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE1MTdYA1m9lqO/FEeGPNoXAAiv/MFAlpLX6AACgkQGPNoXAAi
v/MjnRAA7vWlLJ2jVgKBTC/sh9wN5G3wBOdQx2QhPI+8WLUhHNZLTA53tG4WOIXo
r5eBd2HIKWYQUCTKgNAfjf/+v1q6Ist90lQp8XhwfJ0UyV1thsjXcr9CEcqSa9cz
dPzpPQ1efxm51CAXZv474L0wPfe1fcb43LMX/hmlQPPpEa/VcfBjtqh+AOaHaGjW
+izJK5OJ61FbRE6QB5EG9AWItxxs36nf11W/QJgtPEs1+9t5seKtZ9xGXovUWF7+
y1WXSL+kwjd/pszL+o21ukpvFL7w0YdpIDm1MIeVJNinb4eObBAH/vUx7LfXX1+D
qCD2y4nBTfH+R4lFJZcTTABe+2cxNkQuljYPW+NmSjA15dP6VkDVGCAbzY3IhFJI
IiRfNMvILEoGlXFWXoPJT234Wn8Mf6IoURPHeMq6HtdtSH7oDW47+A+qu3g6wLCL
vSxyq1Sz40M2EpYC10ndHP4CG+F3al198+9Jz2sFCunsS3icbbbO6Nsyr3KEFdET
/+dkIcSf3zarAOwfUZzrkN3KWn4XQjbNCXMm0QVp5mYXULppevLdKPa6ckB2mOea
b79wbipn7sVUCOb535O88JGQHw6T/PzGzeKIczBFqoGITr4POQ34tjSW8Dmc3owp
p0YGBMnoiXGM5fmb6Bw3t8AwM8rkXWbIlE7lHYxZzfpCeVBA934=
=L5kI
-----END PGP SIGNATURE-----
Bump version to v0.3.0

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2 files changed
tree: add111e9398e1040676a57269592f64655be9ee8
  1. .gitignore
  2. .travis.yml
  3. Dockerfile
  4. Gopkg.lock
  5. Gopkg.toml
  6. LICENSE
  7. Makefile
  8. README.md
  9. VERSION
  10. base.go
  11. format.go
  12. main.go
  13. maintainer.go
  14. vendor/
  15. version/
README.md

dockfmt

TravisCI

Dockerfile format.

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

Installation

Binaries

Via Go

$ go get github.com/jessfraz/dockfmt

Usage

Help output

$ dockfmt -h
NAME:
   dockfmt - Dockerfile format.

USAGE:
   dockfmt [global options] command [command options] [arguments...]

VERSION:
   v0.3.0

AUTHOR(S):
   @jessfraz <no-reply@butts.com>

COMMANDS:
     base         list the base image used in Dockerfile(s)
     dump         dump parsed Dockerfile(s)
     format, fmt  format the Dockerfile(s)
     maintainer   list the maintainer for Dockerfile(s)
     help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug, -D    run in debug mode
   --help, -h     show help
   --version, -v  print the version

Format

help output

$ dockfmt fmt -h
NAME:
   dockfmt format - format the Dockerfile(s)

USAGE:
   dockfmt format [command options] [arguments...]

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

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 <jess@linux.com>
+
+FROM	alpine:latest
+MAINTAINER	Jessie Frazelle <jess@linux.com>

-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 <jess@jskdj.com>                113
Christian Koep <christian.koep@ksldkfj.de>      11
Justin Garrison <justinleegarrison@hskdl.com>   2
Daniel Romero <infoslack@jjskl.com>             1
Cris G c@skdlemfhtj.com                         1