Replace copied-in tzinfo database with -tags timetzdata

This commit is contained in:
Seednode 2024-01-19 14:56:40 -06:00
parent e394824ae5
commit 172fc38f18
4 changed files with 4 additions and 16 deletions

View File

@ -52,5 +52,5 @@ for platform in "${platforms[@]}"; do
if [ "${GOOS}" == "windows" ]; then if [ "${GOOS}" == "windows" ]; then
output_name+=".exe" output_name+=".exe"
fi fi
env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" CGO_ENABLED=0 go build -trimpath -ldflags "${ld_flags}" -o "builds/${output_name}" env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" CGO_ENABLED=0 go build -trimpath -ldflags "${ld_flags}" -tags timetzdata -o "builds/${output_name}"
done done

View File

@ -17,7 +17,7 @@ import (
const ( const (
AllowedCharacters string = `^[A-z0-9.\-_]+$` AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "6.2.0" ReleaseVersion string = "6.3.0"
) )
var ( var (

View File

@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 \ RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \ GOOS=$TARGETOS \
GOARCH=$TARGETARCH \ GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o $app \ go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
&& upx --best --lzma $app \ && upx --best --lzma $app \
&& chmod 500 $app && chmod 500 $app
@ -35,12 +35,6 @@ USER nonroot
# copy in binary # copy in binary
COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app
# copy in time zone info
COPY --from=build --chown=root:root --chmod=0004 /usr/local/go/lib/time/zoneinfo.zip /
# load time zone info
ENV ZONEINFO=/zoneinfo.zip
# listen on an unprivileged port # listen on an unprivileged port
EXPOSE 8080 EXPOSE 8080

View File

@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 \ RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \ GOOS=$TARGETOS \
GOARCH=$TARGETARCH \ GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o $app \ go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
&& upx --best --lzma $app \ && upx --best --lzma $app \
&& chmod 500 $app && chmod 500 $app
@ -35,12 +35,6 @@ USER root
# copy in binary # copy in binary
COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app
# copy in time zone info
COPY --from=build --chown=root:root --chmod=0004 /usr/local/go/lib/time/zoneinfo.zip /
# load time zone info
ENV ZONEINFO=/zoneinfo.zip
# listen on an unprivileged port # listen on an unprivileged port
EXPOSE 8080 EXPOSE 8080