Update Dockerfile
Browse files- Dockerfile +14 -12
Dockerfile
CHANGED
|
@@ -15,7 +15,7 @@ RUN apk update && apk upgrade && \
|
|
| 15 |
# 基础工具
|
| 16 |
curl \
|
| 17 |
sudo \
|
| 18 |
-
gosu \
|
| 19 |
wget \
|
| 20 |
ca-certificates \
|
| 21 |
# 编译工具(用于nginx编译)
|
|
@@ -36,8 +36,8 @@ RUN apk update && apk upgrade && \
|
|
| 36 |
&& rm -rf /var/cache/apk/*
|
| 37 |
|
| 38 |
# 创建nginx用户和组
|
| 39 |
-
RUN addgroup -g 101 -S nginx && \
|
| 40 |
-
|
| 41 |
|
| 42 |
# 下载并编译安装nginx主线版本
|
| 43 |
RUN cd /tmp && \
|
|
@@ -58,8 +58,8 @@ RUN cd /tmp && \
|
|
| 58 |
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
|
| 59 |
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
|
| 60 |
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
|
| 61 |
-
--user=nginx \
|
| 62 |
-
--group=nginx \
|
| 63 |
--with-http_ssl_module \
|
| 64 |
--with-http_realip_module \
|
| 65 |
--with-http_addition_module \
|
|
@@ -91,15 +91,16 @@ RUN cd /tmp && \
|
|
| 91 |
rm -rf /tmp/nginx-${NGINX_VERSION}* && \
|
| 92 |
# 创建必要的目录
|
| 93 |
mkdir -p /var/cache/nginx && \
|
| 94 |
-
mkdir -p /var/log/nginx
|
| 95 |
-
#
|
| 96 |
-
|
| 97 |
-
chown -R nginx:nginx /var/
|
|
|
|
| 98 |
|
| 99 |
# 创建nginx配置文件(修改端口为7860)
|
| 100 |
# 屏蔽警告?: nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
|
| 101 |
-
RUN echo 'user nginx;' > /etc/nginx/nginx.conf && \
|
| 102 |
-
|
| 103 |
echo 'error_log /var/log/nginx/error.log;' >> /etc/nginx/nginx.conf && \
|
| 104 |
echo 'pid /var/run/nginx.pid;' >> /etc/nginx/nginx.conf && \
|
| 105 |
echo '' >> /etc/nginx/nginx.conf && \
|
|
@@ -179,7 +180,8 @@ RUN echo '#!/bin/sh' > /start.sh && \
|
|
| 179 |
echo 'nginx -t' >> /start.sh && \
|
| 180 |
echo 'echo ""' >> /start.sh && \
|
| 181 |
echo 'echo "Starting nginx on port 7860..."' >> /start.sh && \
|
| 182 |
-
echo 'exec gosu root nginx -g "daemon off;"' >> /start.sh && \
|
|
|
|
| 183 |
chmod +x /start.sh
|
| 184 |
|
| 185 |
# 设置工作目录
|
|
|
|
| 15 |
# 基础工具
|
| 16 |
curl \
|
| 17 |
sudo \
|
| 18 |
+
# gosu \
|
| 19 |
wget \
|
| 20 |
ca-certificates \
|
| 21 |
# 编译工具(用于nginx编译)
|
|
|
|
| 36 |
&& rm -rf /var/cache/apk/*
|
| 37 |
|
| 38 |
# 创建nginx用户和组
|
| 39 |
+
# RUN addgroup -g 101 -S nginx && \
|
| 40 |
+
# adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx
|
| 41 |
|
| 42 |
# 下载并编译安装nginx主线版本
|
| 43 |
RUN cd /tmp && \
|
|
|
|
| 58 |
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
|
| 59 |
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
|
| 60 |
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
|
| 61 |
+
# --user=nginx \
|
| 62 |
+
# --group=nginx \
|
| 63 |
--with-http_ssl_module \
|
| 64 |
--with-http_realip_module \
|
| 65 |
--with-http_addition_module \
|
|
|
|
| 91 |
rm -rf /tmp/nginx-${NGINX_VERSION}* && \
|
| 92 |
# 创建必要的目录
|
| 93 |
mkdir -p /var/cache/nginx && \
|
| 94 |
+
mkdir -p /var/log/nginx
|
| 95 |
+
# mkdir -p /var/log/nginx && \
|
| 96 |
+
# # 设置权限
|
| 97 |
+
# chown -R nginx:nginx /var/cache/nginx && \
|
| 98 |
+
# chown -R nginx:nginx /var/log/nginx
|
| 99 |
|
| 100 |
# 创建nginx配置文件(修改端口为7860)
|
| 101 |
# 屏蔽警告?: nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
|
| 102 |
+
# RUN echo 'user nginx;' > /etc/nginx/nginx.conf && \
|
| 103 |
+
RUN echo 'worker_processes auto;' >> /etc/nginx/nginx.conf && \
|
| 104 |
echo 'error_log /var/log/nginx/error.log;' >> /etc/nginx/nginx.conf && \
|
| 105 |
echo 'pid /var/run/nginx.pid;' >> /etc/nginx/nginx.conf && \
|
| 106 |
echo '' >> /etc/nginx/nginx.conf && \
|
|
|
|
| 180 |
echo 'nginx -t' >> /start.sh && \
|
| 181 |
echo 'echo ""' >> /start.sh && \
|
| 182 |
echo 'echo "Starting nginx on port 7860..."' >> /start.sh && \
|
| 183 |
+
# echo 'exec gosu root nginx -g "daemon off;"' >> /start.sh && \ # hf不允许提权
|
| 184 |
+
echo 'exec nginx -g "daemon off;"' >> /start.sh && \
|
| 185 |
chmod +x /start.sh
|
| 186 |
|
| 187 |
# 设置工作目录
|