Add timezone support (#550)

This commit is contained in:
Caedis
2026-05-05 13:47:32 -05:00
committed by GitHub
parent 2e6d68aade
commit 84d7feb357
3 changed files with 15 additions and 2 deletions
+3 -1
View File
@@ -13,9 +13,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
FROM alpine AS certs FROM alpine AS certs
RUN apk add -U \ RUN apk add -U \
ca-certificates ca-certificates \
tzdata
FROM scratch FROM scratch
ENTRYPOINT ["/mc-router"] ENTRYPOINT ["/mc-router"]
COPY --from=certs /etc/ssl/certs/ /etc/ssl/certs COPY --from=certs /etc/ssl/certs/ /etc/ssl/certs
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /build/mc-router /mc-router COPY --from=builder /build/mc-router /mc-router
+3 -1
View File
@@ -1,11 +1,13 @@
FROM alpine AS certs FROM alpine AS certs
RUN apk add -U \ RUN apk add -U \
ca-certificates ca-certificates \
tzdata
FROM scratch FROM scratch
ARG TARGETPLATFORM ARG TARGETPLATFORM
COPY --from=certs /etc/ssl/certs/ /etc/ssl/certs COPY --from=certs /etc/ssl/certs/ /etc/ssl/certs
COPY --from=certs /usr/share/zoneinfo /usr/share/zoneinfo
COPY $TARGETPLATFORM/mc-router / COPY $TARGETPLATFORM/mc-router /
ENTRYPOINT ["/mc-router"] ENTRYPOINT ["/mc-router"]
+9
View File
@@ -121,6 +121,15 @@ Some other features included:
The [multi-architecture image published at Docker Hub](https://hub.docker.com/repository/docker/itzg/mc-router) supports amd64, arm64, and arm32v6 (i.e. RaspberryPi). The [multi-architecture image published at Docker Hub](https://hub.docker.com/repository/docker/itzg/mc-router) supports amd64, arm64, and arm32v6 (i.e. RaspberryPi).
## Timezone
The image bundles `tzdata` so log timestamps can match your local timezone. Pick one:
- Set the `TZ` environment variable, e.g. `TZ=America/New_York`
- Bind mount the host's zone file: `-v /etc/localtime:/etc/localtime:ro`
If neither is set, timestamps are in UTC.
## Docker Compose Usage ## Docker Compose Usage
The diagram below shows how this `docker-compose.yml` configures two Minecraft server services named `vanilla` and `forge`, which also become the internal network aliases. _Notice those services don't need their ports exposed since the internal networking allows for the inter-container access._ The diagram below shows how this `docker-compose.yml` configures two Minecraft server services named `vanilla` and `forge`, which also become the internal network aliases. _Notice those services don't need their ports exposed since the internal networking allows for the inter-container access._