🐳 设置时区.

This commit is contained in:
lijiahang
2024-05-28 13:13:17 +08:00
parent 76295ba1e3
commit 9c2b37ec29
3 changed files with 28 additions and 3 deletions

View File

@@ -1,9 +1,17 @@
FROM mysql:8.0.28
# 系统时区
ARG TZ=Asia/Shanghai
# 设置时区
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo '${TZ}' > /etc/timezone
# 复制配置
COPY ./my.cnf /etc/mysql/conf.d/my.cnf
# 复制初始化脚本
COPY ./sql/init-1-schema-databases.sql /tmp
COPY ./sql/init-2-schema-tables.sql /tmp
COPY ./sql/init-3-schema-quartz.sql /tmp
COPY ./sql/init-4-data.sql /tmp
COPY ./my.cnf /etc/mysql/conf.d/my.cnf
# 设置初始化脚本
RUN cat /tmp/init-1-schema-databases.sql >> /tmp/init.sql && \
cat /tmp/init-2-schema-tables.sql >> /tmp/init.sql && \
cat /tmp/init-3-schema-quartz.sql >> /tmp/init.sql && \

View File

@@ -1,4 +1,17 @@
FROM redis:6.0.16-alpine
WORKDIR /data
# 系统时区
ARG TZ=Asia/Shanghai
# 切换源
RUN \
echo "" > /etc/apk/repositories && \
echo "http://mirrors.aliyun.com/alpine/v3.8/main" >> /etc/apk/repositories && \
echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
apk update
# 设置时区
RUN apk add tzdata && \
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo '${TZ}' > /etc/timezone
# redis 配置
COPY ./redis.conf /tmp
RUN cat /tmp/redis.conf > /usr/local/redis.conf

View File

@@ -1,6 +1,7 @@
FROM nginx:alpine
USER root
# 时区
WORKDIR /app
# 系统时区
ARG TZ=Asia/Shanghai
# 切换源
RUN \
@@ -12,11 +13,14 @@ RUN \
RUN apk add tzdata && \
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo '${TZ}' > /etc/timezone
# 添加 jdk
RUN apk add openjdk8
# 删除原 nginx 配置
RUN rm -rf /etc/nginx/conf.d/*
WORKDIR /app
# 复制包
COPY ./orion-visor-launch.jar /app/app.jar
COPY ./dist /usr/share/nginx/html
COPY ./entrypoint.sh /app/entrypoint.sh
COPY ./nginx.conf /etc/nginx/conf.d
# 启动
ENTRYPOINT [ "sh", "/app/entrypoint.sh" ]