This commit is contained in:
none
2023-06-14 09:46:37 +08:00
parent f91382f3c5
commit 904be7605c
6 changed files with 55 additions and 69 deletions

View File

@@ -2,15 +2,22 @@ FROM mysql:5.7.42
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
# 时区配置
ARG TZ=UTC
ENV TZ ${TIMEZONE}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone && chown -R mysql:root /var/lib/mysql/
# 复制自定义的my.cnf
COPY my.cnf /etc/mysql/conf.d/my.cnf
# 初始化数据库
COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d
# my.cnf只读权限
RUN chmod 0444 /etc/mysql/conf.d/my.cnf
CMD ["mysqld"]
# 暴露3306端口
EXPOSE 3306
# 启动mysql
CMD ["mysqld"]