forked from unpoller/unpoller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (53 loc) · 1.81 KB
/
Dockerfile
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
#
# This is part of Application Builder.
# https://github.com/golift/application-builder
#
ARG ARCH=amd64
ARG OS=linux
ARG BUILD_DATE=0
ARG COMMIT=0
ARG VERSION=unknown
ARG BINARY=application-builder
FROM golang:latest as builder
ARG ARCH
ARG OS
ARG BINARY
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /${BINARY}
COPY . /${BINARY}
WORKDIR /${BINARY}
RUN apt update && \
apt install -y upx && \
CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS}
FROM scratch
ARG ARCH
ARG OS
ARG BUILD_DATE
ARG COMMIT
ARG VERSION
ARG LICENSE=MIT
ARG BINARY
ARG SOURCE_URL=http://github.com/golift/application-builder
ARG DESC=application-builder
ARG VENDOR=golift
ARG AUTHOR=golift
ARG CONFIG_FILE=config.conf
# Build-time metadata as defined at https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.title="${BINARY}" \
org.opencontainers.image.documentation="${SOURCE_URL}/wiki/Docker" \
org.opencontainers.image.description="${DESC}" \
org.opencontainers.image.url="${SOURCE_URL}" \
org.opencontainers.image.revision="${COMMIT}" \
org.opencontainers.image.source="${SOURCE_URL}" \
org.opencontainers.image.vendor="${VENDOR}" \
org.opencontainers.image.authors="${AUTHOR}" \
org.opencontainers.image.architecture="${OS} ${ARCH}" \
org.opencontainers.image.licenses="${LICENSE}" \
org.opencontainers.image.version="${VERSION}"
COPY --from=builder /${BINARY}/${BINARY}.${ARCH}.${OS} /image
COPY --from=builder /${BINARY}/examples/${CONFIG_FILE}.example /etc/${BINARY}/${CONFIG_FILE}
COPY --from=builder /${BINARY}/init/webserver /usr/lib/unifi-poller/web
COPY --from=builder /etc/ssl /etc/ssl
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
ENV TZ=UTC
ENTRYPOINT [ "/image" ]