minid

minid is Dockerfile minifier for reducing the number of layers.

  • Owner: orisano/minid
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

minid

minid is Dockerfile minifier for reducing the number of layers.

Features

  • concatenate RUN command
  • concatenate ENV command
  • concatenate COPY, ADD command
  • ...

Installation

go get -u github.com/orisano/minid

How to use

$ cat Dockerfile # 8 layers
FROM golang:1.10-alpine3.8 AS build

ENV DEP_VERSION 0.4.1

WORKDIR /go/src/github.com/orisano/gobase

RUN apk add --no-cache git make mailcap tzdata
RUN wget -O /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 && chmod +x /usr/local/bin/dep
RUN wget -O /usr/local/bin/depinst https://github.com/orisano/depinst/releases/download/1.0.1/depinst-linux-amd64 && chmod +x /usr/local/bin/depinst

COPY Gopkg.lock Gopkg.toml ./
RUN dep ensure -vendor-only

ENV CGO_ENABLED=0
ENV GO_LDFLAGS="-extldflags='-static'"
RUN go build -i ./vendor/...

COPY . .
RUN make build
$ minid # 6 layers
FROM golang:1.10-alpine3.8 AS build
ENV DEP_VERSION=0.4.1
WORKDIR /go/src/github.com/orisano/gobase
RUN apk add --no-cache git make mailcap tzdata && wget -O /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 && chmod +x /usr/local/bin/dep && wget -O /usr/local/bin/depinst https://github.com/orisano/depinst/releases/download/1.0.1/depinst-linux-amd64 && chmod +x /usr/local/bin/depinst
COPY Gopkg.lock Gopkg.toml ./
RUN dep ensure -vendor-only
ENV CGO_ENABLED=0 GO_LDFLAGS="-extldflags='-static'"
RUN go build -i ./vendor/...
COPY . .
RUN make build
$ minid, docker build -f - .

Author

Nao YONASHIRO (@orisano)

License

MIT

Main metrics

Overview
Name With Ownerorisano/minid
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2018-06-30 12:27:16
Pushed At2025-06-25 07:57:21
Last Commit At2025-06-25 16:57:04
Release Count1
Last Release Namev0.1.0 (Posted on )
First Release Namev0.1.0 (Posted on )
用户参与
Stargazers Count52
Watchers Count6
Fork Count3
Commits Count73
Has Issues Enabled
Issues Count2
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count1
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private