mirror of https://github.com/0xERR0R/blocky.git
41 lines
890 B
Docker
41 lines
890 B
Docker
# build stage
|
|
FROM golang:1.17-alpine AS build-env
|
|
RUN apk add --no-cache \
|
|
git \
|
|
make \
|
|
gcc \
|
|
libc-dev \
|
|
zip \
|
|
ca-certificates
|
|
|
|
ENV GO111MODULE=on \
|
|
CGO_ENABLED=0
|
|
|
|
WORKDIR /src
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# add source
|
|
ADD . .
|
|
|
|
ARG opts
|
|
RUN env ${opts} make build
|
|
|
|
# final stage
|
|
FROM alpine:3.14
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/0xERR0R/blocky" \
|
|
org.opencontainers.image.url="https://github.com/0xERR0R/blocky" \
|
|
org.opencontainers.image.title="DNS proxy as ad-blocker for local network"
|
|
|
|
RUN apk add --no-cache ca-certificates bind-tools tini tzdata
|
|
COPY --from=build-env /src/bin/blocky /app/blocky
|
|
|
|
HEALTHCHECK --interval=1m --timeout=3s CMD dig @127.0.0.1 -p 53 healthcheck.blocky +tcp +short || exit 1
|
|
|
|
WORKDIR /app
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
CMD ["/app/blocky","--config","/app/config.yml"]
|