Install tzdata and default TimeZone=UTC in the container
This commit is contained in:
+8
-1
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user