Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time zoneが動かない #111

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dockerfiles/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ FROM alpine:3.18.2

WORKDIR /

RUN apk add --update --no-cache ca-certificates tzdata && update-ca-certificates \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& rm -rf /usr/share/zoneinfo
Comment on lines +33 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この書き方にしたらtime.LoadLocation("Asia/Tokyo")がちゃんと実行できました

Suggested change
RUN apk add --update --no-cache ca-certificates tzdata && update-ca-certificates \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& rm -rf /usr/share/zoneinfo
RUN apk add --update --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

portalの実装ではタイムゾーンの参照はLocalとしてしかしていないので/etc/localtimeにさえAsia/Tokyoの情報があればOKだったみたいです

ですが、traQ gazerではtime.LoadLocation("Asia/Tokyo")として参照しているので/usr/share/zoneinfo以下に該当のタイムゾーンの情報が存在している必要があるみたいです
golangのtimeライブラリでタイムゾーン変換

また、ca-certificatesパッケージやそれを使ってのupdate-ca-certificatesではtraQ gazerには不要です


COPY --from=client-build /app/dist dist
COPY --from=server-build /github.com/traP-jp/h23s_15/app app

Expand Down