!10 compose镜像加速

This commit is contained in:
白书科技
2024-07-05 05:36:41 +00:00
parent 0a5286d026
commit 5fa072592a
24 changed files with 2175 additions and 966 deletions

2
docker/data/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -1,18 +1,5 @@
FROM mysql:8.1
FROM registry.cn-hangzhou.aliyuncs.com/hzbs/mysql:8.1
# 时区配置
ARG TZ=UTC
ENV TZ ${TIMEZONE}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone && chown -R mysql:root /var/lib/mysql/
# 复制自定义的my.cnf
COPY my.cnf /etc/mysql/conf.d/my.cnf
# my.cnf只读权限
RUN chmod 0444 /etc/mysql/conf.d/my.cnf
# 暴露3306端口
EXPOSE 3306
# 启动mysql
CMD ["mysqld"]
RUN chmod 0444 /etc/mysql/conf.d/my.cnf

View File

@@ -1,21 +1,11 @@
client_max_body_size 50m;
server {
# 监听端口号9800
listen 9800;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/pc;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
@@ -24,35 +14,23 @@ server {
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号9801
listen 9801;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/h5;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
@@ -61,35 +39,23 @@ server {
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号9900
listen 9900;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/admin;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
@@ -98,14 +64,12 @@ server {
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
@@ -113,16 +77,11 @@ server {
server {
# 监听端口号80
listen 9700;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/pc;
# 指定默认的索引文件为index.html
index index.html;
# 将所有请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@@ -1,9 +1,3 @@
FROM redis:7.0.12
FROM registry.cn-hangzhou.aliyuncs.com/hzbs/redis:7.0.12
COPY redis.conf /usr/local/etc/redis/redis.conf
VOLUME /data
EXPOSE 6379
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]
COPY redis.conf /usr/local/etc/redis/redis.conf