mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'patch-1' of github.com:firecat53/wtf into firecat53-patch-1
This commit is contained in:
commit
9551428908
17
Dockerfile
17
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,10 @@ ENV PATH=$PATH:./bin
|
||||
|
||||
RUN make build
|
||||
|
||||
ENTRYPOINT "wtfutil"
|
||||
FROM alpine
|
||||
|
||||
COPY --from=build /go/src/github.com/wtfutil/wtf/bin/wtfutil /usr/local/bin/
|
||||
RUN adduser -h /config -DG users -u 20000 wtf
|
||||
|
||||
USER wtf
|
||||
ENTRYPOINT ["wtfutil"]
|
||||
|
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/
|
17
Makefile
17
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: build clean contrib_check coverage help install isntall lint run size test uninstall
|
||||
.PHONY: build clean contrib_check coverage docker-build docker-install help install isntall lint run size test uninstall
|
||||
|
||||
# detect GOPATH if not set
|
||||
ifndef $(GOPATH)
|
||||
@ -48,6 +48,21 @@ coverage:
|
||||
go test -coverprofile=coverage.out ./...
|
||||
go tool cover -html=coverage.out
|
||||
|
||||
## docker-build: builds in docker
|
||||
docker-build:
|
||||
@echo "Building ${APP} in Docker..."
|
||||
docker build -t wtfutil:build --build-arg=version=master -f Dockerfile.build .
|
||||
@echo "Done with docker build"
|
||||
|
||||
## docker-install: installs a local version of the app from docker build
|
||||
docker-install:
|
||||
@echo "Installing ${APP}..."
|
||||
docker create --name wtf_build wtfutil:build
|
||||
docker cp wtf_build:/usr/local/bin/wtfutil ~/.local/bin/
|
||||
$(eval INSTALLPATH = $(shell which ${APP}))
|
||||
@echo "${APP} installed into ${INSTALLPATH}"
|
||||
docker rm wtf_build
|
||||
|
||||
## gosec: runs the gosec static security scanner against the source code
|
||||
gosec:
|
||||
gosec -tests ./...
|
||||
|
23
README.md
23
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
|
||||
@ -122,14 +135,20 @@ make run
|
||||
You can run `wtf` inside a docker container:
|
||||
|
||||
```bash
|
||||
# download the source
|
||||
git clone https://github.com/wtfutil/wtf
|
||||
# download or create the Dockerfile
|
||||
curl -o Dockerfile https://raw.githubusercontent.com/wtfutil/wtf/master/Dockerfile
|
||||
|
||||
# build the docker container
|
||||
docker build -t wtfutil .
|
||||
|
||||
# or for a particular tag or branch
|
||||
docker build --build-args=version=v0.25.0 -t wtfutil .
|
||||
|
||||
# run the container
|
||||
docker run -it wtfutil
|
||||
|
||||
# run container with a local config file
|
||||
docker run -it -v path/to/config.yml:/config/config.yml wtfutil --config=/config/config.yml
|
||||
```
|
||||
|
||||
## Communication
|
||||
|
Loading…
x
Reference in New Issue
Block a user