Changes to for deployment

This commit is contained in:
Thatcher Peskens 2020-12-04 12:02:41 +01:00
parent 6e7a3278ac
commit 15d27d6aca
4 changed files with 25 additions and 5 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
Dockerfile
Dockerfile.geoip

View File

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

18
Dockerfile.geoip Normal file
View File

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

View File

@ -32,7 +32,7 @@
<div class="content">
<div class="pure-g gutters center">
<div class="pure-u-1 pure-u-md-1-2">
<h1>{{ .Hostname }} — What is my IP address?</h1>
<h1>{{ .Host }} — What is my IP address?</h1>
<p><code class="ip">{{ .IP }}</code></p>
<p>
The best tool to find your own IP address, and information about it.