Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orisano/minid
minid is Dockerfile minifier for reducing the number of layers.
https://github.com/orisano/minid
cli docker golang minify
Last synced: 14 days ago
JSON representation
minid is Dockerfile minifier for reducing the number of layers.
- Host: GitHub
- URL: https://github.com/orisano/minid
- Owner: orisano
- License: mit
- Created: 2018-06-30T12:27:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-02T11:53:55.000Z (8 months ago)
- Last Synced: 2024-04-02T13:15:43.482Z (8 months ago)
- Topics: cli, docker, golang, minify
- Language: Go
- Homepage:
- Size: 771 KB
- Stars: 51
- Watchers: 7
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minid
[![Build Status](https://github.com/orisano/minid/workflows/test/badge.svg)](https://github.com/orisano/minid/actions?query=workflow%3Atest)
minid is Dockerfile minifier for reducing the number of layers.
## Features
* concatenate RUN command
* concatenate ENV command
* concatenate LABEL command
* concatenate COPY, ADD command
* ...## Installation
```bash
go get -u github.com/orisano/minid
```## How to use
```bash
$ cat Dockerfile # 8 layers
FROM golang:1.10-alpine3.8 AS buildENV 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/depinstCOPY Gopkg.lock Gopkg.toml ./
RUN dep ensure -vendor-onlyENV CGO_ENABLED=0
ENV GO_LDFLAGS="-extldflags='-static'"
RUN go build -i ./vendor/...COPY . .
RUN make build
```
```bash
$ 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
```
```bash
$ minid | docker build -f - .
```
or
```bash
$ minid build .
```## Author
Nao Yonashiro (@orisano)## License
MIT