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

Add build Dockerfile to build wtfutil from source in Docker and then copy binary to local machine

This commit is contained in:
Scott Hansen 2020-01-12 16:22:55 -08:00
parent b8710d6c45
commit 571526b993
2 changed files with 31 additions and 0 deletions

18
Dockerfile.build Normal file
View File

@ -0,0 +1,18 @@
FROM golang:1.13 as build
ARG version=master
RUN 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
ENV GOSUMDB=off
WORKDIR $GOPATH/src/github.com/wtfutil/wtf
ENV PATH=$PATH:./bin
RUN make build && \
cp bin/wtfutil /usr/local/bin/

View File

@ -115,6 +115,19 @@ make install
make run
```
### Installing from Source using Docker
All building is done inside a docker container. You can then copy the binary to
your local machine.
```bash
curl -o Dockerfile.build https://raw.githubusercontent.com/wtfutil/wtf/master/Dockerfile.build
docker build -f Dockerfile.build -t wtfutil --build-args=version=master .
docker create --name wtf_build wtfutil
docker cp wtf_build:/usr/local/bin/wtfutil ~/.local/bin
docker rm wtf_build
```
**Note:** WTF is _only_ compatible with Go versions **1.12.0** or later (due to the use of Go modules and newer standard library functions). If you would like to use `gccgo` to compile, you _must_ use `gccgo-9` or later which introduces support for Go modules.
## Running via Docker