support setting timezone in docker images (#2091)

This commit is contained in:
Bowen Liang 2024-01-19 20:30:36 +08:00 committed by GitHub
parent ec1659cba0
commit 9ad7b65996
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,7 @@ RUN pip install --prefix=/pkg -r requirements.txt
# build stage # build stage
FROM python:3.10-slim AS builder FROM python:3.10-slim AS builder
ENV FLASK_APP app.py ENV FLASK_APP app.py
ENV EDITION SELF_HOSTED ENV EDITION SELF_HOSTED
ENV DEPLOY_ENV PRODUCTION ENV DEPLOY_ENV PRODUCTION
@ -23,6 +24,11 @@ ENV APP_WEB_URL http://127.0.0.1:3000
EXPOSE 5001 EXPOSE 5001
# set timezone
ENV TZ UTC
RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone
WORKDIR /app/api WORKDIR /app/api
RUN apt-get update \ RUN apt-get update \

View File

@ -2,6 +2,9 @@
FROM node:20.11.0-alpine AS base FROM node:20.11.0-alpine AS base
LABEL maintainer="takatost@gmail.com" LABEL maintainer="takatost@gmail.com"
RUN apk add --no-cache tzdata
# install packages # install packages
FROM base as packages FROM base as packages
@ -32,6 +35,10 @@ ENV CONSOLE_API_URL http://127.0.0.1:5001
ENV APP_API_URL http://127.0.0.1:5001 ENV APP_API_URL http://127.0.0.1:5001
ENV PORT 3000 ENV PORT 3000
# set timezone
ENV TZ UTC
RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone
WORKDIR /app/web WORKDIR /app/web
COPY --from=builder /app/web/public ./public COPY --from=builder /app/web/public ./public