From e2afe5b914ae056adbd62c1d5f16b4e7155ed2eb Mon Sep 17 00:00:00 2001 From: jessikitty Date: Sun, 23 Aug 2026 00:07:53 +1000 Subject: [PATCH] Install tzdata and default TimeZone=UTC in the container --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6583686..b4d3c56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,12 @@ RUN dotnet publish NoticeBoard.csproj -c Release -o /app/publish --no-restore FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime WORKDIR /app +# tzdata is required for TimeZoneInfo.FindSystemTimeZoneById to resolve IANA ids +# (e.g. "Australia/Melbourne") on Linux — without it, only "UTC" would work. +RUN apt-get update \ + && apt-get install -y --no-install-recommends tzdata \ + && rm -rf /var/lib/apt/lists/* + COPY --from=build /app/publish . # Make sure the folders that need to be writable exist even before a volume is mounted @@ -21,7 +27,8 @@ RUN mkdir -p /data /app/wwwroot/uploads ENV ASPNETCORE_HTTP_PORTS=8080 \ ASPNETCORE_ENVIRONMENT=Production \ - DataDirectory=/data + DataDirectory=/data \ + TimeZone=UTC EXPOSE 8080 VOLUME ["/data", "/app/wwwroot/uploads"]