Spaces:
Running
Running
rogerxavier
commited on
Update Dockerfile
Browse files- Dockerfile +14 -7
Dockerfile
CHANGED
@@ -1,18 +1,25 @@
|
|
1 |
-
#
|
2 |
FROM nginx:alpine
|
3 |
|
4 |
-
#
|
5 |
-
RUN mkdir -p /var/cache/nginx && \
|
|
|
|
|
|
|
|
|
6 |
chown -R nginx:nginx /var/cache/nginx
|
7 |
|
8 |
-
#
|
9 |
COPY . /usr/share/nginx/html
|
10 |
|
11 |
-
#
|
|
|
|
|
|
|
12 |
USER nginx
|
13 |
|
14 |
-
#
|
15 |
EXPOSE 7860
|
16 |
|
17 |
-
#
|
18 |
CMD ["nginx", "-g", "daemon off;"]
|
|
|
1 |
+
# 使用基于Alpine的官方Nginx镜像
|
2 |
FROM nginx:alpine
|
3 |
|
4 |
+
# 创建缓存目录并赋予适当的权限
|
5 |
+
RUN mkdir -p /var/cache/nginx/client_temp && \
|
6 |
+
mkdir -p /var/cache/nginx/proxy_temp && \
|
7 |
+
mkdir -p /var/cache/nginx/fastcgi_temp && \
|
8 |
+
mkdir -p /var/cache/nginx/scgi_temp && \
|
9 |
+
mkdir -p /var/cache/nginx/uwsgi_temp && \
|
10 |
chown -R nginx:nginx /var/cache/nginx
|
11 |
|
12 |
+
# 复制你的网页文件到Nginx的HTML目录
|
13 |
COPY . /usr/share/nginx/html
|
14 |
|
15 |
+
# 设置工作目录的权限
|
16 |
+
RUN chown -R nginx:nginx /usr/share/nginx/html
|
17 |
+
|
18 |
+
# 设置用户为nginx,以确保以正确的权限运行
|
19 |
USER nginx
|
20 |
|
21 |
+
# 暴露必要的端口
|
22 |
EXPOSE 7860
|
23 |
|
24 |
+
# 启动Nginx
|
25 |
CMD ["nginx", "-g", "daemon off;"]
|