Add a multistage Dockerfile

This commit is contained in:
Samuel Demirdjian 2020-03-11 16:52:46 -07:00
parent 69e0914a1f
commit 66472eb412
2 changed files with 38 additions and 0 deletions

28
Dockerfile Normal file
View file

@ -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"]

View file

@ -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.