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:
parent
beccd014f6
commit
8221cb9173
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 GOPROXY=https://proxy.golang.org,direct
|
||||||
ENV GO111MODULE=on
|
ENV GO111MODULE=on
|
||||||
@ -14,4 +17,6 @@ ENV PATH=$PATH:./bin
|
|||||||
|
|
||||||
RUN make build
|
RUN make build
|
||||||
|
|
||||||
|
FROM alpine
|
||||||
|
COPY --from=build /go/src/github.com/wtfutil/wtf/bin/wtfutil /usr/local/bin/
|
||||||
ENTRYPOINT "wtfutil"
|
ENTRYPOINT "wtfutil"
|
||||||
|
@ -122,12 +122,15 @@ make run
|
|||||||
You can run `wtf` inside a docker container:
|
You can run `wtf` inside a docker container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# download the source
|
# download or create the Dockerfile
|
||||||
git clone https://github.com/wtfutil/wtf
|
curl -o Dockerfile https://raw.githubusercontent.com/wtfutil/wtf/master/Dockerfile
|
||||||
|
|
||||||
# build the docker container
|
# build the docker container
|
||||||
docker build -t wtfutil .
|
docker build -t wtfutil .
|
||||||
|
|
||||||
|
# or for a particular tag or branch
|
||||||
|
docker build --build-args=version=v0.25.0 -t wtfutil .
|
||||||
|
|
||||||
# run the container
|
# run the container
|
||||||
docker run -it wtfutil
|
docker run -it wtfutil
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user