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:
parent
e9feea4898
commit
042e135147
|
@ -0,0 +1,3 @@
|
||||||
|
README.md
|
||||||
|
Dockerfile
|
||||||
|
|
|
@ -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"]
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
version: "3.4"
|
||||||
|
|
||||||
|
services:
|
||||||
|
ifconfig:
|
||||||
|
image: ifconfig.io:latest
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
target: production
|
||||||
|
ports:
|
||||||
|
- ${PORT:-8080}:8080
|
||||||
|
environment:
|
||||||
|
TLS: ${TLS:-0}
|
||||||
|
HOSTNAME: ${HOSTNAME}
|
Loading…
Reference in New Issue