Skip to content

moul/dockerpatch

Repository files navigation

dockerpatch

🐳 Read, write, manipulate, convert & apply filters to Dockerfiles

GoDoc

Web demo

A demo is available on dockerpatch.appspot.com

Screenshot

Install

go get github.com/moul/dockerpatch/...

Examples

$ cat input
FROM ubuntu:14.04

RUN apt-get update && apt-get install wget -y
RUN wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb
RUN dpkg -i influxdb_latest_amd64.deb
RUN rm -r /opt/influxdb/shared

VOLUME /opt/influxdb/shared

CMD /usr/bin/influxdb --pidfile /var/run/influxdb.pid -config /opt/influxdb/shared/config.toml

EXPOSE 8083
EXPOSE 8086
EXPOSE 8090
EXPOSE 8099

$ dockerpatch --to-arm --optimize ./input
FROM armbuild/ubuntu:14.04
RUN apt-get update && apt-get install wget -y && wget http://s3.amazonaws.com/influxdb/influxdb_latest_armhf.deb && dpkg -i influxdb_latest_armhf.deb && rm -r /opt/influxdb/shared
VOLUME /opt/influxdb/shared
CMD /usr/bin/influxdb --pidfile /var/run/influxdb.pid -config /opt/influxdb/shared/config.toml
EXPOSE 8083 8086 8090 8099

cat input | dockerpatch --to-arm -
FROM armbuild/ubuntu:14.04
RUN apt-get update && apt-get install wget -y
RUN wget http://s3.amazonaws.com/influxdb/influxdb_latest_armhf.deb
RUN dpkg -i influxdb_latest_armhf.deb
RUN rm -r /opt/influxdb/shared
VOLUME /opt/influxdb/shared
CMD /usr/bin/influxdb --pidfile /var/run/influxdb.pid -config /opt/influxdb/shared/config.toml
EXPOSE 8083
EXPOSE 8086
EXPOSE 8090
EXPOSE 8099

cat input | dockerpatch --disable-network -
FROM ubuntu:14.04
RUN apt-get update && apt-get install wget -y
RUN wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb
RUN dpkg -i influxdb_latest_amd64.deb
RUN rm -r /opt/influxdb/shared
VOLUME /opt/influxdb/shared
CMD /usr/bin/influxdb --pidfile /var/run/influxdb.pid -config /opt/influxdb/shared/config.toml

Usage

$ dockerpatch -h
NAME:
   dockerpatch - Read, write, manipulate, convert & apply filters to Dockerfiles

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

VERSION:
   0.1.0

AUTHOR(S):
   Manfred Touron <https://github.com/moul/dockerpatch>

COMMANDS:
   patch	Patch a Dockerfile with filters
   help, h	Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h		show help
   --version, -v	print the version
$ dockerpatch patch -h
NAME:
   patch - Patch a Dockerfile with filters

USAGE:
   command patch [command options] [arguments...]

DESCRIPTION:
   patch [--to-arm]

OPTIONS:
   --to-arm		Convert to armhf architecture
   --disable-network	Remove network rules
   --optimize		Optimize Dockerfile

License

MIT