From 15d27d6aca15b83206ee3ddaaad9c54f90c83fbe Mon Sep 17 00:00:00 2001 From: Thatcher Peskens Date: Fri, 4 Dec 2020 12:02:41 +0100 Subject: [PATCH] Changes to for deployment --- .dockerignore | 2 ++ Dockerfile | 8 ++++---- Dockerfile.geoip | 18 ++++++++++++++++++ html/index.html | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile.geoip diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..30ecf57 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +Dockerfile.geoip \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3c2e089..e6f18a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,9 @@ RUN make # Run FROM scratch EXPOSE 8080 -COPY --from=build \ - /go/bin/echoip \ - /go/src/github.com/mpolden/echoip/index.html \ - /opt/echoip/ + +COPY --from=build /go/bin/echoip /opt/echoip/ +COPY html /opt/echoip/html + WORKDIR /opt/echoip ENTRYPOINT ["/opt/echoip/echoip"] diff --git a/Dockerfile.geoip b/Dockerfile.geoip new file mode 100644 index 0000000..6dc4ec1 --- /dev/null +++ b/Dockerfile.geoip @@ -0,0 +1,18 @@ +# Build +FROM golang:1.13-buster AS build +WORKDIR /go/src/github.com/mpolden/echoip +COPY . . +# Must build without cgo because libc is unavailable in runtime image +ENV GO111MODULE=on CGO_ENABLED=0 +RUN make + +# Run +FROM scratch +EXPOSE 8080 + +COPY --from=build /go/bin/echoip /opt/echoip/ +COPY html /opt/echoip/html +COPY data /opt/echoip/data + +WORKDIR /opt/echoip +ENTRYPOINT ["/opt/echoip/echoip"] diff --git a/html/index.html b/html/index.html index f32e3a5..48d4aa4 100644 --- a/html/index.html +++ b/html/index.html @@ -32,7 +32,7 @@
-

{{ .Hostname }} — What is my IP address?

+

{{ .Host }} — What is my IP address?

{{ .IP }}

The best tool to find your own IP address, and information about it.