2024-07-24 14:59:36 +08:00
FROM golang:1.22-alpine AS builder
2021-04-06 01:26:35 +08:00
WORKDIR /go/src/app
2024-07-24 14:59:36 +08:00
RUN apk update && apk add upx ca-certificates tzdata
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
2024-07-24 14:59:36 +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 .
RUN go version && upx -q adguardhome-sync
2021-04-06 01:26:35 +08:00
# 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"]
2022-01-24 23:56:49 +08:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
2024-01-05 16:27:36 +08:00
COPY --from=builder /usr/share/zoneinfo/ /usr/share/zoneinfo/
COPY --from=builder /go/src/app/adguardhome-sync /opt/go/adguardhome-sync
2021-04-06 01:26:35 +08:00
USER 1001