Tyrrrz / DiscordChatExporter

Exports Discord chat logs to a file
MIT License
7.73k stars 704 forks source link

Docker image missing tzdata package #1293

Closed andrewlow closed 1 month ago

andrewlow commented 1 month ago

Version

v2.43.3

Flavor

CLI (Command-Line Interface)

Platform

Docker

Export format

HTML

Steps to reproduce

I'm running the docker image. I noticed that my HTML output contains

Timezone: UTC+0

Despite the fact that I'm providing the environment variable -e TZ=America/Toronto to my docker command line.

I believe this worked in the past, but something has changed.

Details

Expected: Setting the TZ environment variable would provide dates with the right timezone

Actual: Docker container always runs in UTC

Checklist

andrewlow commented 1 month ago

A trivial reproduction without a lot of setup

$ docker run --rm -it --name discord-scrape -e TZ=America/Toronto --entrypoint /bin/sh tyrrrz/discordchatexporter:stable

/out # date
Thu Sep 19 17:28:23 UTC 2024

So it appears that the date command is not picking up the timezone.

Dumping the environment

/out # env
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
HOSTNAME=ffa38c718a14
SHLVL=1
HOME=/root
DOTNET_RUNNING_IN_CONTAINER=true
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ASPNETCORE_HTTP_PORTS=8080
LANG=en_US.UTF-8
APP_UID=1654
LC_ALL=en_US.UTF-8
PWD=/out
TZ=America/Toronto

Shows that the TZ variable is correctly set.

andrewlow commented 1 month ago

I believe that the base alpine image - is either no longer, or has had the tzdata package removed.

Extending the example above - you can 'fix' this by adding the tzdata package

/out # date
Thu Sep 19 17:29:56 UTC 2024
/out # apk add tzdata
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
(1/1) Installing tzdata (2024a-r0)
OK: 47 MiB in 21 packages
/out # date
Thu Sep 19 13:30:42 EDT 2024
/out # 

If the dockerfile is modified to include the tzdata package - this should resolve the problem.

Tyrrrz commented 1 month ago

Please open a PR to add it