Skip to content

Commit 0a74b60

Browse files
committed
more readme updates
1 parent 155b428 commit 0a74b60

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

README.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
This package can be used to load the timezone database from the standard location
99
(`/usr/share/zoneinfo`) on MacOS and Linux computers. It includes a parser for
10-
the `tzfile` format, as well as a utility functions to convert a timestamp from
11-
the [gleam_time](https://hexdocs.pm/gleam_time/) library into a date and time
10+
the Time Zone Information Format (TZif) or `tzfile` format, as well as utility
11+
functions to convert a timestamp from the
12+
[gleam_time](https://hexdocs.pm/gleam_time/) library into a date and time
1213
of day in the given timezone.
1314

1415
> We could really do with a timezone database package with a
@@ -22,16 +23,74 @@ To use, add the following entry in your `gleam.toml` file dependencies:
2223
timezone = { git = "[email protected]:devries/timezone.git", ref = "main" }
2324
```
2425
# Installing the zoneinfo data files
26+
Timezone information is frequently updated, therefore it makes sense to use the
27+
package manager for your operating system to keep the timezone database up to
28+
date. All common unix variants have timezone database packages and install the
29+
timezone database files into the `/usr/share/zoneinfo` directory by default.
2530

2631
## MacOS
2732
The files should be included in your operating system by default. Check the
2833
`/usr/share/zoneinfo` directory and see if they are present.
2934

3035
## Ubuntu/Debian Linux Systems
36+
The APT package manager can be used to install the compiled TZif files with the
37+
following command:
38+
39+
```
40+
sudo apt install tzdata
41+
```
42+
43+
### Debian based docker containers
44+
Installing and configuring the timezone database on a Debian or Ubuntu based
45+
docker container can be done by adding the following to your `Dockerfile`:
46+
47+
```
48+
# Use an ARG for the timezone, with a default of UTC
49+
ARG TIMEZONE=Etc/UTC
50+
51+
# Set the TZ environment variable and install tzdata
52+
RUN apt-get update && \
53+
export DEBIAN_FRONTEND=noninteractive && \
54+
ln -fs /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
55+
apt-get install -y tzdata && \
56+
dpkg-reconfigure --frontend noninteractive tzdata
57+
```
3158

3259
## Alpine Linux Systems
60+
The Alpine Package Keeper can install the timezone database using the command:
61+
62+
```
63+
sudo apk add tzdata
64+
```
65+
66+
### Alpine based docker containers
67+
Installing and configuring the timezone database on an Alpine based docker
68+
container can be done by adding the following to your `Dockerfile`:
69+
70+
```
71+
# Use an ARG for the timezone, with a default of UTC
72+
ARG TIMEZONE=Etc/UTC
73+
74+
# 1. Install the tzdata package
75+
# 2. Copy the correct timezone file to /etc/localtime
76+
# 3. Set the TZ environment variable to be used by applications
77+
RUN apk add --no-cache tzdata && \
78+
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
79+
echo "${TIMEZONE}" > /etc/timezone
80+
```
3381

3482
## Red Hat/Rocky/Alma Linux Systems
83+
You can use the YUM package manager or DNF to install the timezone database
84+
on Red Hat variants. To use YUM run the command:
3585

86+
```
87+
sudo yum install tzdata
88+
```
89+
90+
Similarly, using DNF:
91+
92+
```
93+
sudo dnf install tzdata
94+
```
3695
## Windows
3796
At this time we have not tested the windows operating system.

0 commit comments

Comments
 (0)