1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Use progressive build to reduce final image size

- Use progressive build to reduce final image size
- Download source during build so only Dockerfile is required to be present on the build host
- Add a `version` arg so any tag or branch can be built: `docker build --build-arg=version=v0.25.0 -t wtf .`
This commit is contained in:
Scott Hansen 2020-01-12 13:59:30 -08:00
parent beccd014f6
commit 8221cb9173
2 changed files with 13 additions and 5 deletions

View File

@ -1,8 +1,11 @@
FROM golang:1.13-alpine
FROM golang:1.13-alpine as build
RUN apk add --no-cache make ncurses
ARG version=master
COPY . $GOPATH/src/github.com/wtfutil/wtf
RUN apk add git make ncurses && \
git clone https://github.com/wtfutil/wtf.git $GOPATH/src/github.com/wtfutil/wtf && \
cd $GOPATH/src/github.com/wtfutil/wtf && \
git checkout $version
ENV GOPROXY=https://proxy.golang.org,direct
ENV GO111MODULE=on
@ -14,4 +17,6 @@ ENV PATH=$PATH:./bin
RUN make build
FROM alpine
COPY --from=build /go/src/github.com/wtfutil/wtf/bin/wtfutil /usr/local/bin/
ENTRYPOINT "wtfutil"

View File

@ -122,12 +122,15 @@ make run
You can run `wtf` inside a docker container:
```bash
# download the source
git clone https://github.com/wtfutil/wtf
# download or create the Dockerfile
curl -o Dockerfile https://raw.githubusercontent.com/wtfutil/wtf/master/Dockerfile
# build the docker container
docker build -t wtfutil .
# or for a particular tag or branch
docker build --build-args=version=v0.25.0 -t wtfutil .
# run the container
docker run -it wtfutil
```