mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
deployment/docker: embed tzdata into prod Go app instead of installing it into base docker image
While this increases app size by 700Kb, this allows using -loggerTimezone in a scratch base image See https://github.com/golang/go/issues/38017
This commit is contained in:
parent
ff7850aec0
commit
c769f8321d
10 changed files with 11 additions and 20 deletions
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
EXPOSE 8429
|
EXPOSE 8429
|
||||||
ENTRYPOINT ["/vmagent-prod"]
|
ENTRYPOINT ["/vmagent-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
EXPOSE 8427
|
EXPOSE 8427
|
||||||
ENTRYPOINT ["/vmauth-prod"]
|
ENTRYPOINT ["/vmauth-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
ENTRYPOINT ["/vmbackup-prod"]
|
ENTRYPOINT ["/vmbackup-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
COPY vmbackup-${TARGETARCH}-prod ./vmbackup-prod
|
COPY vmbackup-${TARGETARCH}-prod ./vmbackup-prod
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
ENTRYPOINT ["/vmctl-prod"]
|
ENTRYPOINT ["/vmctl-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
COPY vmctl-${TARGETARCH}-prod ./vmctl-prod
|
COPY vmctl-${TARGETARCH}-prod ./vmctl-prod
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
EXPOSE 8480
|
EXPOSE 8480
|
||||||
ENTRYPOINT ["/vminsert-prod"]
|
ENTRYPOINT ["/vminsert-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
ENTRYPOINT ["/vmrestore-prod"]
|
ENTRYPOINT ["/vmrestore-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
COPY vmrestore-${TARGETARCH}-prod ./vmrestore-prod
|
COPY vmrestore-${TARGETARCH}-prod ./vmrestore-prod
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
EXPOSE 8481
|
EXPOSE 8481
|
||||||
ENTRYPOINT ["/vmselect-prod"]
|
ENTRYPOINT ["/vmselect-prod"]
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
ARG certs_image
|
ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
||||||
EXPOSE 8482
|
EXPOSE 8482
|
||||||
EXPOSE 8400
|
EXPOSE 8400
|
||||||
EXPOSE 8401
|
EXPOSE 8401
|
||||||
|
|
|
@ -6,7 +6,7 @@ ROOT_IMAGE ?= alpine:3.13.1
|
||||||
CERTS_IMAGE := alpine:3.13.1
|
CERTS_IMAGE := alpine:3.13.1
|
||||||
GO_BUILDER_IMAGE := golang:1.15.8
|
GO_BUILDER_IMAGE := golang:1.15.8
|
||||||
BUILDER_IMAGE := local/builder:2.0.0-$(shell echo $(GO_BUILDER_IMAGE) | tr : _)
|
BUILDER_IMAGE := local/builder:2.0.0-$(shell echo $(GO_BUILDER_IMAGE) | tr : _)
|
||||||
BASE_IMAGE := local/base:1.1.2-$(shell echo $(ROOT_IMAGE) | tr : _)-$(shell echo $(CERTS_IMAGE) | tr : _)
|
BASE_IMAGE := local/base:1.1.3-$(shell echo $(ROOT_IMAGE) | tr : _)-$(shell echo $(CERTS_IMAGE) | tr : _)
|
||||||
|
|
||||||
package-base:
|
package-base:
|
||||||
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BASE_IMAGE)$$') \
|
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BASE_IMAGE)$$') \
|
||||||
|
@ -34,7 +34,7 @@ app-via-docker: package-builder
|
||||||
$(BUILDER_IMAGE) \
|
$(BUILDER_IMAGE) \
|
||||||
go build $(RACE) -mod=vendor -trimpath \
|
go build $(RACE) -mod=vendor -trimpath \
|
||||||
-ldflags "-extldflags '-static' $(GO_BUILDINFO)" \
|
-ldflags "-extldflags '-static' $(GO_BUILDINFO)" \
|
||||||
-tags 'netgo osusergo nethttpomithttp2' \
|
-tags 'netgo osusergo nethttpomithttp2 timetzdata' \
|
||||||
-o bin/$(APP_NAME)$(APP_SUFFIX)-prod $(PKG_PREFIX)/app/$(APP_NAME)
|
-o bin/$(APP_NAME)$(APP_SUFFIX)-prod $(PKG_PREFIX)/app/$(APP_NAME)
|
||||||
|
|
||||||
package-via-docker: package-base
|
package-via-docker: package-base
|
||||||
|
|
|
@ -3,9 +3,8 @@ ARG certs_image
|
||||||
ARG root_image
|
ARG root_image
|
||||||
FROM $certs_image as certs
|
FROM $certs_image as certs
|
||||||
|
|
||||||
RUN apk --update --no-cache add ca-certificates tzdata
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM $root_image
|
FROM $root_image
|
||||||
|
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo/
|
|
Loading…
Reference in a new issue