diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5451a8f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# BUILDER +FROM golang AS builder + +ENV CGO_ENABLED=0 \ + GOOS=linux \ + GOARCH=amd64 + +WORKDIR $GOPATH/src/ + +COPY *.go ./ + +RUN go build \ + -a -tags netgo -ldflags '-w -extldflags "-static"' \ + -o /go/bin/capture \ + *.go + + +# MAIN +FROM alpine + +EXPOSE 9000 9001 + +COPY --from=builder /go/bin/capture /opt/capture + +USER 10001 + +ENTRYPOINT ["/opt/capture"] + diff --git a/README.md b/README.md index 6627a0e..be990c3 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ proxying the response back to the client, while showing them in a dashboard ./capture -url=https://example.com/ +or using Docker (see how to build the image below) + + docker run -p 9000:9000 -p 9001:9001 capture -url=https://example.com/ + #### Settings @@ -56,6 +60,12 @@ Now you have an executable binary in your directory **Note:** you can change `GOOS=darwin` to `linux` or `windows` to create an executable for your corresponding Operating System +Building a Docker image: + + git clone --depth 1 https://github.com/ofabricio/capture.git + cd capture + docker build . -t capture + ## Plugins Put [plugin](https://golang.org/pkg/plugin/) files in the current directory.