From fa4ce210f450d34e9a9a6bbae4ea1a8ab5294192 Mon Sep 17 00:00:00 2001 From: redhat <2292650292@qq.com> Date: Wed, 21 May 2025 17:17:10 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81add=20compose.2=20change=20dockerfile?= =?UTF-8?q?=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- compose.yaml | 37 +++++++++++++++++++++++++++++++++++++ mysql.env | 3 +++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 compose.yaml create mode 100644 mysql.env diff --git a/Dockerfile b/Dockerfile index 2b6a9f0..f6e3bc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ WORKDIR /app COPY ./static . # 从builder镜像中把配置文件拷贝到当前目录 -COPY ./conf . +COPY ./config . # 从builder镜像中把/dist/app 拷贝到当前目录 COPY --from=builder /build/app . diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..9bde99b --- /dev/null +++ b/compose.yaml @@ -0,0 +1,37 @@ +services: + mysql: + image: mariadb:10.11 + command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW --max-binlog-size=200M --expire-logs-days=2 # 优化mysql配置 + restart: unless-stopped + volumes: + - ./stack/data/mysql:/var/lib/mysql:Z + environment: + - MYSQL_ROOT_PASSWORD=redhat + - MARIADB_AUTO_UPGRADE=1 + - MARIADB_DISABLE_UPGRADE_BACKUP=1 + env_file: + - mysql.env + + redis: + image: redis:alpine + restart: unless-stopped + volumes: + - ./stack/data/redis:/data + + app: + build: . + restart: unless-stopped + hostname: dash + volumes: + - ./stack/data/app:/var/www/html:z + environment: + - MYSQL_HOST=mysql + - REDIS_HOST=redis + - TZ=Asia/Shanghai + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - db.env + depends_on: + - mysql + - redis \ No newline at end of file diff --git a/mysql.env b/mysql.env new file mode 100644 index 0000000..69d5c4e --- /dev/null +++ b/mysql.env @@ -0,0 +1,3 @@ +MYSQL_PASSWORD=redhat +MYSQL_DATABASE=dashboard +MYSQL_USER=dashboard