Update Dockerfile
Browse files- Dockerfile +6 -5
Dockerfile
CHANGED
|
@@ -15,6 +15,7 @@ RUN apk update && apk upgrade && \
|
|
| 15 |
# 基础工具
|
| 16 |
curl \
|
| 17 |
sudo \
|
|
|
|
| 18 |
wget \
|
| 19 |
ca-certificates \
|
| 20 |
# 编译工具(用于nginx编译)
|
|
@@ -35,8 +36,8 @@ RUN apk update && apk upgrade && \
|
|
| 35 |
&& rm -rf /var/cache/apk/*
|
| 36 |
|
| 37 |
# 创建nginx用户和组
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
# 下载并编译安装nginx主线版本
|
| 42 |
RUN cd /tmp && \
|
|
@@ -97,8 +98,8 @@ RUN cd /tmp && \
|
|
| 97 |
|
| 98 |
# 创建nginx配置文件(修改端口为7860)
|
| 99 |
# 屏蔽警告?: nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
|
| 100 |
-
|
| 101 |
-
|
| 102 |
echo 'error_log /var/log/nginx/error.log;' >> /etc/nginx/nginx.conf && \
|
| 103 |
echo 'pid /var/run/nginx.pid;' >> /etc/nginx/nginx.conf && \
|
| 104 |
echo '' >> /etc/nginx/nginx.conf && \
|
|
@@ -178,7 +179,7 @@ RUN echo '#!/bin/sh' > /start.sh && \
|
|
| 178 |
echo 'nginx -t' >> /start.sh && \
|
| 179 |
echo 'echo ""' >> /start.sh && \
|
| 180 |
echo 'echo "Starting nginx on port 7860..."' >> /start.sh && \
|
| 181 |
-
echo 'nginx -g "daemon off;"' >> /start.sh && \
|
| 182 |
chmod +x /start.sh
|
| 183 |
|
| 184 |
# 设置工作目录
|
|
|
|
| 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 && \
|
|
|
|
| 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 |
+
echo 'worker_processes auto;' >> /etc/nginx/nginx.conf && \
|
| 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 |
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 |
# 设置工作目录
|