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:
11
Dockerfile
11
Dockerfile
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user