2022-01-10 01:15:54 +08:00
|
|
|
FROM docker.io/library/golang:1.17 as builder
|
2021-04-06 01:26:35 +08:00
|
|
|
|
|
|
|
WORKDIR /go/src/app
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y upx
|
|
|
|
|
|
|
|
ARG VERSION=main
|
2021-08-10 00:15:24 +08:00
|
|
|
ARG BUILD="N/A"
|
|
|
|
|
2021-04-06 01:26:35 +08:00
|
|
|
ENV GOPROXY=https://goproxy.io \
|
|
|
|
GO111MODULE=on \
|
|
|
|
CGO_ENABLED=0 \
|
|
|
|
GOOS=linux
|
|
|
|
|
|
|
|
ADD . /go/src/app/
|
|
|
|
|
2021-08-10 00:15:24 +08:00
|
|
|
RUN go build -a -installsuffix cgo -ldflags="-w -s -X github.com/bakito/adguardhome-sync/version.Version=${VERSION} -X github.com/bakito/adguardhome-sync/version.Build=${BUILD}" -o adguardhome-sync . \
|
2021-04-06 01:26:35 +08:00
|
|
|
&& upx -q adguardhome-sync
|
|
|
|
|
|
|
|
# application image
|
|
|
|
FROM scratch
|
|
|
|
WORKDIR /opt/go
|
|
|
|
|
|
|
|
LABEL maintainer="bakito <github@bakito.ch>"
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/opt/go/adguardhome-sync"]
|
|
|
|
CMD ["run", "--config", "/config/adguardhome-sync.yaml"]
|
|
|
|
COPY --from=builder /go/src/app/adguardhome-sync /opt/go/adguardhome-sync
|
|
|
|
USER 1001
|