xiangpei
2025-04-18 ccadf9480d4e6a9dcc227a2a0b1f9ae0612e36fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
version: 3.9
services:
  # redis
  redis:
    image: redis
    restart: on-failure
    networks:
      - easyblog
  # mysql
  mysql:
    image: mysql:8
    restart: always
    ports:
      - 3306:3306  # 需要可以远程访问
    volumes:
      - mysqldata:/var/lib/mysql   # 自动数据卷,数据库数据
      - mysqlconf:/etc/mysql/conf.d   # 自动数据卷,数据库配置
      - mysqllog:/var/log/mysql   # 自动数据卷,数据库日志
    networks:
      - easyblog
    environment:
      MYSQL_USER: root
      MYSQL_ROOT_PASSWORD: root
    depends_on:
      - redis
  # 博客程序
  easy-blog:
    build:
      context: .
      dockerfile: src/docker/Dockerfile
    restart: always
    volumes:
      - /root/user/local/java/easyblog:/user/local/java   # 将jar包和配置文件映射到容器内
    networks:
      - easyblog
    depends_on:
      - mysql
  # nginx
  nginx:
    image: nginx
    restart: always
    volumes:
      - /root/user/local/nginx:/user/local/nginx  # 将ssl证书和配置文件映射到容器内
    ports:
      - 80:80       # 80、443映射到主机端口
      - 443:443
    networks:
      - easyblog
    depends_on:
      - easy-blog