diff --git a/.changelog/26794.txt b/.changelog/26794.txt new file mode 100644 index 000000000..869821c1d --- /dev/null +++ b/.changelog/26794.txt @@ -0,0 +1,3 @@ +```release-note:improvement +build: Add tzdata to Docker container final image +``` diff --git a/Dockerfile b/Dockerfile index 430b5e526..f299a3ad5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,15 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 +# We use a multi-stage build, so we can add tzdata to the final image but still +# produce a Busybox image. +FROM alpine@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 AS builder + +RUN apk add --no-cache tzdata + # docker.io/library/busybox:1.36.0 # When pinning use the multi-arch manifest list, `docker buildx imagetools inspect ...` -FROM docker.io/library/busybox@sha256:9e2bbca079387d7965c3a9cee6d0c53f4f4e63ff7637877a83c4c05f2a666112 as release +FROM docker.io/library/busybox@sha256:9e2bbca079387d7965c3a9cee6d0c53f4f4e63ff7637877a83c4c05f2a666112 AS release ARG PRODUCT_NAME=nomad ARG PRODUCT_VERSION @@ -25,6 +31,9 @@ LABEL maintainer="Nomad Team " \ org.opencontainers.image.vendor="HashiCorp" \ org.opencontainers.image.licenses="BUSL-1.1" +# Copy over the TZ data from the builder stage into the release image. +COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo + RUN mkdir -p /usr/share/doc/nomad COPY LICENSE /usr/share/doc/nomad/LICENSE.txt