docker-compose.yml 部署Nginx、Java项目、MySQL、Redis


version: "3.7" services: nginx: image: nginx restart: always container_name: nginx environment: - TZ=Asia/Shanghai ports: - "80:80" - "443:443" volumes: - /docker/nginx/conf.d:/etc/nginx/conf.d - /docker/nginx/log:/var/log/nginx - /docker/nginx/www:/etc/nginx/html - /etc/letsencrypt:/etc/letsencrypt jrebel: restart: always environment: - TZ=Asia/Shanghai build: context: /application/apps dockerfile: jrebel_dockerfile container_name: jrebel ports: - 8091:8091 mysql: restart: always image: mysql:8 container_name: mysql8 ports: - "3306:3306" command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true --lower_case_table_names=1 --default-time-zone=+8:00 environment: MYSQL_ROOT_PASSWORD: "password" volumes: - "/docker/mysql/db:/var/lib/mysql" - "/docker/mysql/conf/my.cnf:/etc/my.cnf" redis: image: redis container_name: redis environment: - TZ=Asia/Shanghai command: redis-server /usr/local/etc/redis/redis.conf ports: - "6379:6379" volumes: - /docker/redis/data:/data - /docker/redis/redis.conf:/usr/local/etc/redis/redis.conf

 

nginx.conf

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
    
    location = /favicon.ico {
           log_not_found off;
            access_log off;
    }
    
    location / {
            root   html;
            index  index.html index.htm;
    }
    location /jrebel/ {
        proxy_pass  http://127.0.0.1:8091/;
    }

}

jrebel_dockerfile

FROM java:8
ADD Jrebel_1.0.jar Jrebel_1.0.jar
EXPOSE  8091
ENTRYPOINT ["java","-jar","Jrebel_1.0.jar","-p","8091"]

mysql 配置my.cnf

[mysqld]
user=mysql
default-storage-engine=INNODB
character-set-server=utf8mb4
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4

redis 配置 redis.conf

requirepass redispassword

 

转载于:https://www.cnblogs.com/layezi/p/11569407.html

你可能感兴趣的:(docker-compose.yml 部署Nginx、Java项目、MySQL、Redis)