From 31862dea6ef025dbff084806def5a8efc09286c8 Mon Sep 17 00:00:00 2001 From: Shen Jiamin Date: Tue, 16 Jun 2026 19:10:13 +0800 Subject: [PATCH] feat(docker): pass system timezone as build arg Co-authored-by: Vlad-Gabriel Serbu Signed-off-by: Shen Jiamin --- scripts/Dockerfile.package-rocky | 4 ++-- scripts/Dockerfile.package-ubuntu | 4 ++-- scripts/Dockerfile.run-rocky | 5 ++--- scripts/Dockerfile.run-ubuntu | 4 ++-- scripts/run-with-docker.sh | 1 + 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/Dockerfile.package-rocky b/scripts/Dockerfile.package-rocky index b77ca3fe..bb9cbb73 100644 --- a/scripts/Dockerfile.package-rocky +++ b/scripts/Dockerfile.package-rocky @@ -12,7 +12,7 @@ RUN dnf install -y python3 python3-devel python3-jinja2 python3-pip python3-setu ncurses-compat-libs glib2 libXext libXrender-devel pixman lsb_release # Setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ENV LC_ALL=en_US.utf-8 @@ -21,5 +21,5 @@ RUN useradd -m -U -u $USER_ID slash USER slash # Again, setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" ENV LC_ALL=en_US.utf-8 diff --git a/scripts/Dockerfile.package-ubuntu b/scripts/Dockerfile.package-ubuntu index 9bccb03d..cfcaf81a 100644 --- a/scripts/Dockerfile.package-ubuntu +++ b/scripts/Dockerfile.package-ubuntu @@ -31,7 +31,7 @@ RUN . /etc/os-release && \ fi # Setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ENV LC_ALL=en_US.utf-8 @@ -44,5 +44,5 @@ RUN if id -u $USER_ID >/dev/null 2>&1; then \ USER slash # Again, setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" ENV LC_ALL=en_US.utf-8 diff --git a/scripts/Dockerfile.run-rocky b/scripts/Dockerfile.run-rocky index 66851577..21b4935a 100644 --- a/scripts/Dockerfile.run-rocky +++ b/scripts/Dockerfile.run-rocky @@ -13,7 +13,7 @@ COPY rpm/*.rpm /tmp RUN dnf install -y /tmp/*.rpm # Setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ENV LC_ALL=en_US.utf-8 @@ -22,6 +22,5 @@ RUN useradd -m -U -u $USER_ID slash USER slash # Again, setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" ENV LC_ALL=en_US.utf-8 - diff --git a/scripts/Dockerfile.run-ubuntu b/scripts/Dockerfile.run-ubuntu index 85d0bdf7..5b610ead 100644 --- a/scripts/Dockerfile.run-ubuntu +++ b/scripts/Dockerfile.run-ubuntu @@ -36,7 +36,7 @@ RUN apt install -y /tmp/slash-dev_*.deb \ /tmp/libvrt_*.deb # Setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ENV LC_ALL=en_US.utf-8 @@ -49,5 +49,5 @@ RUN if id -u $USER_ID >/dev/null 2>&1; then \ USER slash # Again, setting timezone and locale for Vivado -ENV TZ="Europe/Dublin" +ARG TZ="Europe/Dublin" ENV LC_ALL=en_US.utf-8 diff --git a/scripts/run-with-docker.sh b/scripts/run-with-docker.sh index 26c00c3e..e2628c9d 100755 --- a/scripts/run-with-docker.sh +++ b/scripts/run-with-docker.sh @@ -201,6 +201,7 @@ IMAGE_TAG="slash-$CONTAINER-$DISTRO:$VERSION" docker build \ --build-arg USER_ID=$(id -u) \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ + --build-arg TZ=$(timedatectl show -p Timezone --value) \ -t "$IMAGE_TAG" \ -f "scripts/Dockerfile.$CONTAINER-$DISTRO" . docker run $DOCKER_RUN_ARGS \