Add Dockerfile and docker-compose.yml

This provides a Dockerfile with an docker-compose.yml to install ifconfig.io on a Docker Server
This commit is contained in:
Malte Reddig
2020-10-05 13:38:38 +02:00
committed by George Shammas
parent e9feea4898
commit 042e135147
3 changed files with 54 additions and 0 deletions

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
FROM golang:alpine AS builder
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
# Move to working directory /build
WORKDIR /build
# Copy and download dependency using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the code into the container
COPY main.go .
# Build the application
RUN go build -o main .
# Move to /dist directory as the place for resulting binary folder
WORKDIR /dist
# Copy binary from build to main folder
RUN cp /build/main .
# Build a small image
FROM scratch AS production
COPY --from=builder /dist/main /
COPY ./templates /templates
COPY ./LICENSE /LICENSE
# Command to run
ENTRYPOINT ["/main"]