1 Star 0 Fork 11

gordensong/lnmp

forked from khs1994-docker/lnmp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
docker-lnmp.yml 9.53 KB
一键复制 编辑 原始数据 按行查看 历史
khs1994 提交于 2023-05-10 23:54 . [MySQL] Update to v8.0.33
#
# @link https://www.ruanyifeng.com/blog/2016/07/yaml.html
#
# @link https://docs.docker.com/compose/
# @link https://docs.docker.com/compose/compose-file/#extension-fields
# @link https://github.com/docker-library/docs
#
x-common-labels:
&common-labels
labels:
- ${LNMP_DOMAIN:-com.khs1994.lnmp}=true
- ${LNMP_DOMAIN:-com.khs1994.lnmp}.app.env=development
x-common:
&common
restart: ${LNMP_RESTART:-always}
env_file: ./scripts/cli/timezone.env
networks:
- backend
read_only: ${LNMP_ROOT_FILESYSTEM_READ_ONLY:-false}
# dns:
# - ${DNS:-114.114.114.114}
x-tmpfs:
&tmpfs
type: tmpfs
target: /run
# tmpfs:
# size: 1000
services:
mysql:
<< : [*common,*common-labels]
image: "${LNMP_LIBRARY_NS:-library}/mysql:${LNMP_MYSQL_VERSION:-8.0.33}"
environment:
# @link https://github.com/docker-library/docs/tree/master/mysql#environment-variables
# @link https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html
# MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
MYSQL_ROOT_PASSWORD: ${LNMP_MYSQL_ROOT_PASSWORD:-mytest}
MYSQL_DATABASE: ${LNMP_MYSQL_DATABASE:-test}
# MYSQL_USER:
# MYSQL_PASSWORD:
ports:
- "${LNMP_MYSQL_PORT:-127.0.0.1:3306}:3306"
- "${LNMP_MYSQL_PORT_X:-127.0.0.1:33060}:33060"
volumes:
- ./config/mysql/conf.d/my.cnf:/etc/mysql/conf.d/my.cnf
# @link https://github.com/docker-library/docs/tree/master/mysql#initializing-a-fresh-instance
- ./scripts/backup/init:/docker-entrypoint-initdb.d:ro
- type: volume
source: mysql-data
target: ${LNMP_MYSQL_DATA:-/var/lib/mysql}
- ./log/mysql:/var/log/mysql
- ./scripts/backup/mysql:/backup
- type: tmpfs
target: /var/run/mysqld
command:
- mysqld
- --character-set-server=utf8mb4
- --default-authentication-plugin=mysql_native_password
secrets:
- db_root_password
# - source: mysql_conf
# target: /etc/mysql/conf.d/my.cnf
# uid: "999"
# gid: "999"
# mode: 0644
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${LNMP_MYSQL_ROOT_PASSWORD:-mytest}"]
retries: 3
timeout: 5s
redis:
<< : [*common,*common-labels]
image: "${LNMP_LIBRARY_NS:-library}/redis:${LNMP_REDIS_VERSION:-7.0.0}-alpine"
ports:
- "${LNMP_REDIS_PORT:-127.0.0.1:6379}:6379"
volumes:
- ./config/redis/redis.conf:/redis.conf:ro
# - redis-data:/data
- type: volume
source: redis-data
target: /data
volume:
nocopy: true
- ./log/redis:/var/log/redis
- << : *tmpfs
# set config by command
command: [
"redis-server",
"/redis.conf",
"--daemonize no",
"--logfile /var/log/redis/redis.log",
"--bind 0.0.0.0",
"--appendonly yes",
# "--save \"\"",
"--aof-use-rdb-preamble yes"
]
healthcheck:
test: ["CMD","redis-cli","ping"]
retries: 3
timeout: 5s
memcached:
<< : [*common,*common-labels]
image: ${LNMP_LIBRARY_NS:-library}/memcached:${LNMP_MEMCACHED_VERSION:-1.6.15}-alpine
ports:
- "${LNMP_MEMCACHED_PORT:-127.0.0.1:11211}:11211"
volumes:
- type: volume
source: zoneinfo-data
target: /usr/share/zoneinfo
volume:
nocopy: true
- << : *tmpfs
php7:
&php7
<< : [*common,*common-labels]
image: "${LNMP_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP7_VERSION:-7.4.33}-fpm-alpine"
volumes:
- &bind_app ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}
# fpm config
- ./config/php/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf:ro
# php.ini
- ./config/php/php.ini:/usr/local/etc/php/php.ini:ro
# php.ini override
- ./config/php/docker-php.ini:/usr/local/etc/php/conf.d/docker-php.ini:ro
# log,etc
- ./log/php:/var/log/php
# supervisord
- ./log/supervisord.log:/var/log/supervisord.log
- ./log/supervisord:/var/log/supervisord
# s6
- ./config/s6/s6-overlay/scripts:/etc/s6-overlay/scripts
- ./config/s6/s6-overlay/${S6_RC_D:-s6-rc.d}:/etc/s6-overlay/s6-rc.d
- ./config/crontabs/root:/etc/crontabs/root.s6
- php7-var-log:/var/log
- type: volume
source: zoneinfo-data
target: /usr/share/zoneinfo
volume:
nocopy: false
networks:
- frontend
- backend
# frontend:
# aliases:
# - php
# backend:
# aliases:
# - php
tmpfs: /run:exec
expose:
- "9000"
# command: php-fpm -R -F
# command: php-fpm -F
environment:
- &lnmp_docker_version LNMP_DOCKER_VERSION=${LNMP_DOCKER_VERSION:-v20.10} x86_64 With Pull Docker Image
- APP_ENV=${APP_ENV:-development}
- LNMP_XDEBUG_REMOTE_HOST=${LNMP_XDEBUG_REMOTE_HOST:-192.168.199.100}
- LNMP_XDEBUG_REMOTE_PORT=${LNMP_XDEBUG_REMOTE_PORT:-9003}
- LNMP_OPCACHE_ENABLE=${LNMP_OPCACHE_ENABLE:-1}
- PATH=/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# - PHP_INI_SCAN_DIR=:/usr/local/etc/php/conf.d
php8:
&php8
<< : [*common,*common-labels]
image: "${LNMP_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP8_VERSION:-8.2.3}-fpm-alpine"
volumes:
- *bind_app
# - ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}
# fpm config
- ./config/php8/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf:ro
# php.ini
- ./config/php8/php.ini:/usr/local/etc/php/php.ini:ro
# php.ini override
- ./config/php8/docker-php.ini:/usr/local/etc/php/conf.d/docker-php.ini:ro
# log,etc
- ./log/php8:/var/log/php
# supervisord
# - ./log/supervisord.log:/var/log/supervisord.log
# - ./log/supervisord:/var/log/supervisord
# s6
- ./config/s6/s6-overlay/scripts:/etc/s6-overlay/scripts
- ./config/s6/s6-overlay/${S6_RC_D:-s6-rc.d}:/etc/s6-overlay/s6-rc.d
- ./config/crontabs/root:/etc/crontabs/root.s6
- php8-var-log:/var/log
- type: volume
source: zoneinfo-data
target: /usr/share/zoneinfo
volume:
nocopy: false
networks:
# - frontend
# - backend
frontend:
aliases:
- php
backend:
aliases:
- php
tmpfs: /run:exec
expose:
- "9000"
# command: php-fpm -R -F
# command: php-fpm -F
environment:
- *lnmp_docker_version
- APP_ENV=${APP_ENV:-development}
- LNMP_XDEBUG_REMOTE_HOST=${LNMP_XDEBUG_REMOTE_HOST:-192.168.199.100}
- LNMP_XDEBUG_REMOTE_PORT=${LNMP_XDEBUG_REMOTE_PORT:-9003}
- LNMP_OPCACHE_ENABLE=${LNMP_OPCACHE_ENABLE:-1}
- PATH=/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# - XDEBUG_MODE
composer:
<< : [*common,*common-labels]
restart: "no"
image: "${LNMP_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP_VERSION:-8.2.3}-composer-alpine"
volumes:
- *bind_app
# - ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}
- type: volume
source: composer-cache-data
target: /tmp/composer/cache
- ./config/composer/config.json:/tmp/composer/config.json
# - ./config/composer/auth.json:/tmp/composer/auth.json
# https://docs.docker.com/config/containers/multi-service_container/
# http://supervisord.org/running.html
supervisord:
<< : *php7
networks:
- backend
image: "${LNMP_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP_VERSION:-7.4.33}-supervisord-alpine"
secrets:
- source: supervisord_ini
target: /etc/supervisor.d/supervisord.ini
command: ["/usr/bin/supervisord","-n"]
expose:
- "9003"
phpmyadmin:
<< : [*common,*common-labels]
image: ${LNMP_LIBRARY_NS:-library}/phpmyadmin:${LNMP_PHPMYADMIN_VERSION:-5.2.0}
environment:
- PMA_HOST=mysql
ports:
- ${LNMP_PHPMYADMIN_PORT:-127.0.0.1:8080}:80
volumes:
- type: volume
source: phpmyadmin-data
target: /sessions
- << : *tmpfs
networks:
- backend
- frontend
healthcheck:
test: ["CMD","curl","-sf","127.0.0.1:80"]
# test: ["CMD-SHELL", "curl -f http://localhost || exit 1"]
nginx:
<< : [*common,*common-labels]
image: "${LNMP_LIBRARY_NS:-library}/nginx:${LNMP_NGINX_VERSION:-1.23.3}-alpine"
ports:
- "${LNMP_NGINX_HTTPS_PORT:-0.0.0.0:443}:443/udp"
- "${LNMP_NGINX_HTTPS_PORT:-0.0.0.0:443}:443/tcp"
- "${LNMP_NGINX_HTTP_PORT:-0.0.0.0:80}:80"
volumes:
# - ./config/nginx:/etc/nginx/conf.d:ro
- type: bind
source: ./config/${LNMP_NGINX_CONF_D:-nginx}
target: /etc/nginx/conf.d
- *bind_app
# - ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}
- ./config/etc/nginx/${LNMP_NGINX_CONF:-nginx.conf}:/etc/nginx/nginx.conf:ro
- ./log/nginx:/var/log/nginx
- << : *tmpfs
working_dir: /app
networks:
- frontend
# depends_on:
# - php8
healthcheck:
test: ["CMD","nginx","-t"]
networks:
frontend:
<< : *common-labels
backend:
<< : *common-labels
volumes:
mysql-data:
<< : *common-labels
redis-data:
<< : *common-labels
zoneinfo-data:
<< : *common-labels
phpmyadmin-data:
<< : *common-labels
composer-cache-data:
<< : *common-labels
php8-var-log:
<< : *common-labels
php7-var-log:
<< : *common-labels
secrets:
db_root_password:
<< : *common-labels
file: ./secrets/${LNMP_DB_ROOT_PASSWORD_PATH:-db_root_password.txt}
supervisord_ini:
<< : *common-labels
file: ./config/supervisord/supervisord.ini
# mysql_conf:
# << : *common-labels
# file: ./config/mysql/conf.d/my.cnf
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Docker
1
https://gitee.com/gordensong/lnmp.git
git@gitee.com:gordensong/lnmp.git
gordensong
lnmp
lnmp
master

搜索帮助