adguardhome-sync/Dockerfile

32 lines
891 B
Text
Raw Normal View History

FROM golang:1.20-bullseye as builder
2021-04-06 01:26:35 +08:00
WORKDIR /go/src/app
RUN apt-get update && \
apt-get install -y upx && \
apt-get upgrade -y # upgrade to get latest ca-certs
2021-04-06 01:26:35 +08:00
ARG VERSION=main
2021-08-10 00:15:24 +08:00
ARG BUILD="N/A"
2022-02-15 01:35:56 +08:00
ENV GO111MODULE=on \
2021-04-06 01:26:35 +08:00
CGO_ENABLED=0 \
GOOS=linux
2022-01-20 04:23:40 +08:00
COPY . /go/src/app/
2021-04-06 01:26:35 +08:00
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
2022-01-24 23:56:49 +08:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
2021-04-06 01:26:35 +08:00
USER 1001