• Stars
    star
    425
  • Rank 102,094 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 8 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dockerfile format and parser. Like `gofmt` but for Dockerfiles.

dockfmt

make-all make-image 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).
  stages      List the stages in the Dockerfile.
  workdir     List the workdirs for the Dockerfile(s).
  version     Show the version information.

Format

Get help

$ dockfmt fmt -h
Usage: dockfmt fmt [OPTIONS] [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 fmt -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

Stage inspection

$ dockfmt stages Dockerfile
STAGE               INTERPOLATED
health-check        false
python-deps         false
stage-2             true

Workdir inspection

$ dockfmt workdir */Dockerfile */*/Dockerfile
WORKDIR   COUNT
/srv      3
/app      1

More Repositories

1

dockerfiles

Various Dockerfiles I use on the desktop and on servers.
Dockerfile
13,270
star
2

dotfiles

My dotfiles. Buyer beware ;)
Shell
3,166
star
3

.vim

My .vim dotfiles and configurations.
Vim Script
618
star
4

gmailfilters

A tool to sync Gmail filters from a config file to your account.
Go
552
star
5

branch-cleanup-action

A GitHub action to automatically delete the branch after a pull request has been merged.
Shell
427
star
6

k8s-snowflake

Configs and scripts for bootstrapping an opinionated Kubernetes cluster anywhere.
Shell
397
star
7

tdash

A terminal dashboard with stats from Google Analytics, GitHub, Travis CI, and Jenkins. Very much built specific to me.
Go
307
star
8

netscan

Scan network ips and ports.
Go
255
star
9

s3server

Server to index & view files in a s3 or Google Cloud Storage bucket.
Go
235
star
10

morningpaper2remarkable

A bot to sync the morning paper to a remarkable tablet.
Go
219
star
11

gitable

Bot to automatically sync and update an airtable sheet with GitHub pull request and issue data.
Go
201
star
12

advent-of-cuda

Doing advent of code with CUDA and rust.
Rust
200
star
13

onion

Tor networking plugin for Docker containers. Route all container tcp traffic through Tor.
Go
198
star
14

hashtag-pull

Get all twitter, vine, and instagram posts with a certain hashtag, print the feed, and save to a database for future use. (old & depreciated)
PHP
180
star
15

gadgets

A repo to keep track of interesting gadgets and toys that I find or someone tells me about.
158
star
16

pony

Local file-based password, API key, secret, recovery code store backed by GPG.
Go
149
star
17

cliaoke

Command Line Karaoke.
Go
147
star
18

jenkins-dsl

Jenkins DSLs for my Jenkins instance, keeps forks up to date, mirrors repositories to private git, builds all Dockerfiles and more.
Groovy
132
star
19

containers

OCI compatible & runc configs for various containers.
Shell
129
star
20

aws-fargate-action

A GitHub action to deploy to AWS Fargate on push to the master branch.
HCL
121
star
21

blog

Source for my blog.
CSS
114
star
22

tupperwarewithspears

Distributed load testing with containers, Apache benchmark, with OpenVSwitch for networking.
Go
108
star
23

openai.vim

OpenAI GPT-3 plugin for vim.
Vim Script
96
star
24

shaking-finger-action

A GitHub action that displays a gif of Conan O'Brien shaking his finger to a pull request on fail.
Shell
95
star
25

cni-benchmarks

A simple program to benchmark various container networking (CNI) plugins.
Go
84
star
26

lkml.wtf

Source code for lkml.wtf.
HTML
78
star
27

jessfraz

74
star
28

pastebinit

Go implementation of pastebinit.
Go
73
star
29

tor

Development fork of https://git.torproject.org/tor.git
C
67
star
30

random-forest-classifier

A random forest classifier in Javascript.
JavaScript
58
star
31

irssi

Official Docker image for irssi.
Shell
50
star
32

strace2elastic

Strace container output to a file, then shove the syscalls into elastic search.
Python
49
star
33

printinator

A MacOS menubar for 3D printers.
Swift
47
star
34

macgyver

The Macgyver of Dlopening: `dlopen` yourself!
Go
45
star
35

ship

Command line tool to track packages using the AfterShip API.
Go
45
star
36

what-can-i-say-im-a-hopeless-open-source-romantic

Repo for designing shirts!
42
star
37

directory-theme

A customizable theme for your Apache or Nginx directory. (old & depreciated)
HTML
39
star
38

terraform-cluster

Scripts to create a minimal mesos or nomad cluster using terraform.
HCL
39
star
39

ykpiv

Go bindings for ykpiv so you can write Go to interact with your yubikeys.
Go
35
star
40

libyubikey

Go bindings for libyubikey so you can write Go to interact with your yubikeys.
Go
35
star
41

dstats

Docker stats dashboard for your terminal. (WIP that was never finished)
JavaScript
34
star
42

tripitcalb0t

Bot to automatically create Google Calendar events from TripIt flight data.
Go
29
star
43

battery

Linux battery status checker.
Makefile
28
star
44

apparmor-docs

Auto generated pdfs of apparmor .odt files direct from launchpad branch.
Makefile
28
star
45

junk

A place for everything without a home.
Go
27
star
46

party-clippy

Go server that shows clippy. Nice for curl in demos.
Go
23
star
47

systemd-butts

Chrome extension to replace systemd with butts on websites.
JavaScript
20
star
48

github-rate-limit

A little web app deployed to Vercel to return a more human-readable JSON output from the GitHub rate limit endpoint.
Go
17
star
49

goodreads-dewey

A tool to get the dewey decimal number for books in your Goodreads account.
Go
16
star
50

docker-presentation

Instructions on building a server with Docker and Nginx on Ubuntu trusty 14.04. (old & depreciated)
Shell
16
star
51

weirdtrickmafia.fm

Site for the podcast.
HTML
15
star
52

linux

Fork of Linux kernel for development (includes linux-security & linux-next).
C
13
star
53

jessfraz-overlay

Portage overlay with custom Gentoo ebuilds.
Shell
12
star
54

secping

A tool for reading the SECURITY_CONTACTS file in a kubernetes repository.
Go
11
star
55

usbc-pal

10
star
56

go-benchmarks

Run go test benchmarks for versions over time.
Dockerfile
6
star
57

snippetlib

Site for hosing code snippets. (old & deprecated)
Less
5
star
58

generator-xbars

Yeoman generator for node with express, handlebars, & bootstrap. (old & depreciated)
JavaScript
3
star
59

present.j3ss.co

Go talk slides made with https://golang.org/x/tools/cmd/present.
Shell
3
star
60

notorious-svg

Barrel Creative Days Project.
CSS
2
star