fcambus / rrda

REST API allowing to perform DNS queries over HTTP
https://www.statdns.com
BSD 2-Clause "Simplified" License
223 stars 56 forks source link

Add simple Dockerfile #3

Closed mcm closed 8 years ago

mcm commented 9 years ago

Just sharing a Dockerfile that is working for us, using the Docker "trusted build" golang image. Usage:

# Build the image
$ docker build -t rrda .

# Run with the default settings, exposing 8080 on the host
$ docker run -p 8080:8080 -d rrda

# Test it
$ curl http://localhost:8080/8.8.8.8:53/example.org/ns
fcambus commented 8 years ago

I'm closing this issue because I'm not sure what value it would add to the project - as it is something I would not personally use.

soullivaneuh commented 4 years ago

For anyone falling to this MR: If you want to make a tiny image by copying the binary, you have to add the following flags on go build: CGO_ENABLED=0 GOOS=linux

Complete Dockerfile:

FROM golang:1-alpine3.11 as build
RUN apk add --no-cache git~=2
RUN git clone --branch 1.1.0 https://github.com/fcambus/rrda.git /build
WORKDIR /build
RUN CGO_ENABLED=0 GOOS=linux go build

FROM scratch
COPY --from=build /build/rrda /rrda
CMD ["/rrda", "-host", "0.0.0.0"]