forked from 0xERR0R/blocky
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (44 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
62 lines (44 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# syntax=docker/dockerfile:1
# ----------- stage: build
FROM golang:alpine AS build
RUN apk add --no-cache make coreutils libcap
# Arguments needed for dependency download
ARG GOPROXY=""
ARG OPTS=""
# setup go environment
ENV GO_SKIP_GENERATE=1\
GO_BUILD_FLAGS="-tags static -v ${OPTS}" \
BIN_USER=100\
BIN_AUTOCAB=1 \
BIN_OUT_DIR="/bin" \
GOPROXY=$GOPROXY
# Copy dependency files first for better caching
COPY go.mod go.sum ./
# Download dependencies (cached layer unless go.mod/go.sum change)
RUN go mod download
# Copy source code after dependencies are cached
COPY . .
# Arguments needed for build step only
ARG VERSION
ARG BUILD_TIME
RUN make build
# ----------- stage: final
FROM scratch
ARG VERSION
ARG BUILD_TIME
ARG DOC_PATH
LABEL org.opencontainers.image.title="blocky" \
org.opencontainers.image.vendor="0xERR0R" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.created="${BUILD_TIME}" \
org.opencontainers.image.description="Fast and lightweight DNS proxy as ad-blocker for local network with many features" \
org.opencontainers.image.url="https://github.com/0xERR0R/blocky#readme" \
org.opencontainers.image.source="https://github.com/0xERR0R/blocky" \
org.opencontainers.image.documentation="https://0xerr0r.github.io/blocky/${DOC_PATH}/"
USER 100
WORKDIR /app
COPY --from=build /bin/blocky /app/blocky
ENV BLOCKY_CONFIG_FILE=/app/config.yml
ENTRYPOINT ["/app/blocky"]
HEALTHCHECK --start-period=1m --timeout=3s CMD ["/app/blocky", "healthcheck"]