django-vue-admin/docker-compose.yml

122 lines
3.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

version: "3"
services:
dvadmin-web:
container_name: dvadmin-web
ports:
- "8080:8080"
build:
context: ./
dockerfile: ./docker_env/web/Dockerfile
environment:
TZ: Asia/Shanghai
volumes:
- ./docker_env/nginx/my.conf:/etc/nginx/conf.d/my.conf
expose:
- "8080"
networks:
network:
ipv4_address: 177.8.0.11
dvadmin-django:
build:
context: .
dockerfile: ./docker_env/django/Dockerfile
container_name: dvadmin-django
working_dir: /backend
# 打开mysql 时,打开此选项
# depends_on:
# - dvadmin-mysql
environment:
PYTHONUNBUFFERED: 1
DATABASE_HOST: dvadmin-mysql
TZ: Asia/Shanghai
volumes:
- ./backend:/backend
- ./logs/log:/var/log
ports:
- "8000:8000"
expose:
- "8000"
restart: always
networks:
network:
ipv4_address: 177.8.0.12
# dvadmin-mysql:
# image: mysql:5.7
# container_name: dvadmin-mysql
# #使用该参数container内的root拥有真正的root权限否则container内的root只是外部的一个普通用户权限
# #设置为true不然数据卷可能挂载不了启动不起
## privileged: true
# restart: always
# ports:
# - "3306:3306"
# environment:
# MYSQL_ROOT_PASSWORD: "123456"
# MYSQL_DATABASE: "dvadmin_pro"
# TZ: Asia/Shanghai
# command:
# --wait_timeout=31536000
# --interactive_timeout=31536000
# --max_connections=1000
# --default-authentication-plugin=mysql_native_password
# volumes:
# - "./docker_env/mysql/data:/var/lib/mysql"
# - "./docker_env/mysql/conf.d:/etc/mysql/conf.d"
# - "./docker_env/mysql/logs:/logs"
# networks:
# network:
# ipv4_address: 177.8.0.13
# 如果使用celery 插件,请自行打开此注释
# dvadmin-celery:
# build:
# context: .
# dockerfile: ./docker_env/celery/Dockerfile
# # image: django:2.2
# container_name: dvadmin-celery
# working_dir: /backend
# depends_on:
# - dvadmin-mysql
# environment:
# PYTHONUNBUFFERED: 1
# DATABASE_HOST: dvadmin-mysql
# TZ: Asia/Shanghai
# volumes:
# - ./backend:/backend
# - ./logs/log:/var/log
# restart: always
# networks:
# network:
# ipv4_address: 177.8.0.14
# dvadmin-redis:
# image: redis:6.2.6-alpine # 指定服务镜像最好是与之前下载的redis配置文件保持一致
# container_name: dvadmin-redis # 容器名称
# restart: on-failure # 重启方式
# environment:
# - TZ=Asia/Shanghai # 设置时区
# volumes: # 配置数据卷
# - ./docker_env/redis/data:/data
# - ./docker_env/redis/redis.conf:/etc/redis/redis.conf
# ports: # 映射端口
# - "6379:6379"
# sysctls: # 设置容器中的内核参数
# - net.core.somaxconn=1024
# command: /bin/sh -c "echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf && redis-server /etc/redis/redis.conf --appendonly yes" # 指定配置文件并开启持久化
# privileged: true # 使用该参数container内的root拥有真正的root权限。否则container内的root只是外部的一个普通用户权限
# networks:
# network:
# ipv4_address: 177.8.0.15
networks:
network:
ipam:
driver: default
config:
- subnet: '177.8.0.0/16'