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:
parent
b8710d6c45
commit
571526b993
18
Dockerfile.build
Normal file
18
Dockerfile.build
Normal 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/
|
13
README.md
13
README.md
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user