39 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2025-08-06 21:44:03 +08:00
# 基于mysql官方镜像debian版本自带apt-get方便安装其他环境
FROM mysql:8.0.43-debian
# 设置中文和UTF-8编码
RUN apt-get update && \
apt-get install -y locales && \
sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen zh_CN.UTF-8 && \
echo 'LANG=zh_CN.UTF-8' > /etc/locale.conf
ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
# 1. 安装 nginx 与 openjdk-17
RUN apt-get update && \
apt-get install -y --no-install-recommends nginx openjdk-17-jre-headless && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# 2. 复制文件
COPY equip-reserve-backend.jar /app/equip-reserve-backend.jar
COPY dist /usr/share/nginx/html
COPY db/*.sql /docker-entrypoint-initdb.d/
COPY nginx.conf /etc/nginx/nginx.conf
# 声明数据卷
VOLUME ["/equip-reserve", "/mysql_data", "/device_image", "/logs"]
# 设置数据库相关环境变量
ENV MYSQL_ROOT_PASSWORD=root123
ENV MYSQL_DATABASE=equip_reserve
ENV MYSQL_USER=equip
ENV MYSQL_PASSWORD=equip123
# 复制启动入口脚本
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
EXPOSE 5173
ENTRYPOINT ["/docker-entrypoint.sh"]