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"